How to export Class and Type
See original GitHub issuesrc/
- foo.ts
- index.ts
foo.ts
type Bar = {
}
export class Foo {
bar: Bar
}
index.ts
import { Foo } from './foo'
export class Index {
person: Foo
}
output
export declare type Bar = {};
declare class Foo {
bar: Bar;
}
export declare class Index {
person: Foo;
}
export {};
There are two issues:
Foo
is not exported.Bar
is exported.
why? I am very confused.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
In typescript, how to export the type of a private class without ...
My goal is to export just the "type" of the private class without letting an module consuming code be able instantiate it directly....
Read more >Documentation - Modules - TypeScript
Any declaration (such as a variable, function, class, type alias, or interface) can be exported by adding the export keyword.
Read more >Example of TypeScript Export Function - eduCBA
By the use of an export keyword, we can export class, function, file, interface, type, etc. in TypeScript. By default it comes up...
Read more >How to use a decorated, exported class as type #41231 - GitHub
You do this by declaring and exporting a type named Bar ...
Read more >export - JavaScript - MDN Web Docs
Every module can have two different types of export, named export and default export. You can have multiple named exports per module but ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I find exporting
.d.ts
files is the hardest part of typescript.I really don’t know how to export the type I want.
@timocov Thank you.