Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript as a language is fragmented into two languages #44360

Closed
canonic-epicure opened this issue Jun 1, 2021 · 2 comments
Closed

TypeScript as a language is fragmented into two languages #44360

canonic-epicure opened this issue Jun 1, 2021 · 2 comments
Labels
Unactionable There isn't something we can do with this issue

Comments

@canonic-epicure
Copy link

Hello,

I found it very discouraging, that TypeScript is currently fragmented into 2 languages. The 1st one is TypeScript itself and 2nd is TypeScript+declaration files. The program, valid in the 1st language, is not valid in the 2nd. This means, the TypeScript is a superset of TypeScript+declarations.

You can express more logic in TypeScript, however the TypeScript+declarations is a standard for distributing code (to avoid recompilation of the source files).

Despite being a well-known issue, this fragmentation is not documented anywhere, and TS development team does provide any feedback about it. It is a hushed up thing, nobody wants to talk about this.

This issue should at least be described in details, on the documentation website.

@canonic-epicure
Copy link
Author

The solution is simple - a design decision should be made, that *.d.ts files should create exactly the same internal compilation data, as regular source files. For that, probably a different format of the declaration files is needed, *.d2.ts

Its very discouraging, when you have to spent hours, mingling your code (that compiles just fine in TypeScript), reducing type-safety, to make it work in the TypeScript+declarations language. In certain cases its not possible at all.

@RyanCavanaugh
Copy link
Member

Duplicate #35822.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unactionable There isn't something we can do with this issue
Projects
None yet
Development

No branches or pull requests

2 participants