Issue
if (process.env.NODE_ENV !== 'production') {
(WithUser as any).displayName = wrapDisplayName(Component, 'withUser');
}
I'm not even sure if as is a keyword, but anyway, what does it do in JavaScript?
Solution
That is not vanilla JavaScript, it is TypeScript. as any tells the compiler to consider the typed object as a plain untyped JavaScript object.
The as keyword is a Type Assertion in TypeScript which tells the compiler to consider the object as another type than the type the compiler infers the object to be.
Answered By - Adrian Brand
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.