-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: enable declarationMap, use .d.ts files in monorepo too #2613
Conversation
I managed to solve this problem by enabling
With
|
I can live with it.
Hmm, this will be annoying.
Understandable.
declare const TodoListApplication_base;
export declare class TodoListApplication extends TodoListApplication_base {
constructor(options?: ApplicationConfig);
}
Is it fixed by #2621? |
I agree it's annoying. As far as I understand Project References, they rely on declaration maps too, and therefore don't support cross-package renames either. So basically we have to choose between the two options:
Considering how much benefits are unlocked by package references (think about Thoughts?
Yes, the error message about noImplictAny violation is fixed by #2621. The type declaration emitted by TypeScript is still using |
7c831b1
to
82e59e2
Compare
Let me play with this PR with VSCode for some time to give more concrete feedbacks. |
|
That's pretty bad :( Do you happen to know if this problem persists with Project References too? |
Configure TSC to emit declaration maps, providing information needed by IDEs like VSCode to jump from usage of a symbol to its definition in the original source code. Simplify layout of all packages, remove top-level `index.ts` and `index.d.ts` files in favor of a package.json entry "types": "dist/index.d.ts" Simplify layout of module packages (excluding example applications) and remove the top-level `index.js` file in favor of a package.json entry "main": "dist/index.js" Update developer documentation and project templates accordingly. Benefits of these changes: - It's a preparation step for TypeScript Project References - Build is consuming less CPU cycles now. User time used to be 5m21 before, it's 1m48s now. Real time went down from 0m49s to 0m37s. - Simpler project setup in our packages, we no longer need to maintain dummy index files at the top level. Drawbacks: - Refactor-rename does not work across packagas. I believe this is a limitation of TypeScript, hopefully it will be eventually fixed. - Navigation across packages may not work until the monorepo is built.
82e59e2
to
febc67f
Compare
This is tracked by the following TypeScript issue: microsoft/TypeScript#30823 |
This issue has been marked stale because it has not seen activity within six months. If you believe this to be in error, please contact one of the code owners, listed in the |
Configure TSC to emit declaration maps, providing information needed by IDEs like VSCode to jump from usage of a symbol to its definition in the original source code.
Simplify layout of all packages, remove top-level
index.ts
andindex.d.ts
files in favor of a package.json entrySimplify layout of module packages (excluding example applications) and remove the top-level
index.js
file in favor of a package.json entry"main": "dist/index.js"
Update developer documentation and project templates accordingly.
Benefits of these changes
It's a preparation step for TypeScript Project References, see chore: add script to build typescript project references #1636
Build is consuming less CPU cycles now. User time on my machine used to be 5m21 before, it's 3m13 now.
UPDATE: With lib check disabled (see build: enable "skipLibCheck", remove "dom" library #2621), the new CPU 1m48s now and the real time is 0m37s.
dummy index files at the top level.
Drawbacks:
Refactor-rename does not work across packagas. I believe this is a
limitation of TypeScript, hopefully it will be eventually fixed.
Navigation across packages may not work until the monorepo is built.
Simpler project setup in our packages, we no longer need to maintain dummy index files at the top level.
Drawbacks
The build is taking slightly more time now. Real time went from 0m49s to 0m56s. This should improve once we enable project references and incremental or watch build.Refactor-rename does not work across packagas. I believe this is a limitation of TypeScript, hopefully it will be eventually fixed.
Navigation across packages may not work until the monorepo is built.
When compiling a class extending from a base class created through mixins, TypeScript emits type definitions that are violating "noImplicitAny" rule.As a result, when our benchmark includesTodoApplication
, the build fails. This problem does not seem to be present when Project References are enabled. As a temporal workaround, the Todo example is exportingsrc/index.ts
for the type definitions.See also #2609
Checklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated