Reputation: 985
If I was exporting
baz.ts
export default {
foo: 5,
bar: 'test'
}
then I was to do
otherFile.ts
import baz from './test.js'
How would I got about getting the type of baz?
Upvotes: 2
Views: 71
Reputation: 73366
With typeof baz
, you get the type of baz
, like this:
type bazType = typeof baz;
Read more in Type Queries and typeof in TypeScript.
Upvotes: 0