3 ms·
I think it is more like .d.ts for TypeScript. Sometimes you do want types in a different file.
by sanxiyn 6y ago
I think it is more like .d.ts for TypeScript. Sometimes you do want types in a different file.
- shadowfacts 6y agoNot really, .ts files can have types in the source code. .d.ts lets you type external JS code which is useful for untyped dependencies, as is the case here, I imagine. But within your own project having types be part of the actual declarations is much better.
- throwaway189262 6y agoThose are only used to retrofit types on external libraries that don't have them. All types within project are in the source. .d.ts is a way to add types to source you don't control. Ruby should have gone the path of typescript where .d.ts generation and type stripping is done by a tool you run when you publish your library. That way you can work with types in your code but export it to plain js that others can use with or without tyoings