|
|
|
|
|
by the_gipsy
3037 days ago
|
|
I didn't mean that it's equal to having `class A {...}`. What I said is that you can export a type and a function with the same name, which is as convenient as importing a class, which is also both a type and a constructor function (edit: with prototype). By "constructor function" I meant a function that constructs an object with a given shape, not a "class instance" or prototyped object. Sorry about not being clear. So no `instanceof`, but you are guaranteed to get correct type checking. See here [1] for example, if you hover `a` it will tell you it is an `A` not a `{a:string}`. [1]: https://www.typescriptlang.org/play/#src=type%20MapToProps%3... |
|