fix: extend fix-types.mjs to process all generated d.ts files for consistent declarations#8501
fix: extend fix-types.mjs to process all generated d.ts files for consistent declarations#8501Copilot wants to merge 6 commits into
Conversation
…st index.d.ts Agent-Logs-Url: https://github.com/pubkey/rxdb/sessions/6d652866-26e5-47b0-bb5b-49279b0ceb90 Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pubkey/rxdb/sessions/6d652866-26e5-47b0-bb5b-49279b0ceb90 Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com>
|
@copilot extend the angular example to test for the correctness |
…ignal typing tests Agent-Logs-Url: https://github.com/pubkey/rxdb/sessions/0c018ec3-d9d3-48d0-8369-ff914a6e9648 Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pubkey/rxdb/sessions/0c018ec3-d9d3-48d0-8369-ff914a6e9648 Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com>
Done in commit
Additionally, added an |
|
@copilot can we also set strictTemplates: true in the angular example? |
Agent-Logs-Url: https://github.com/pubkey/rxdb/sessions/3ee2d15c-af1a-487b-b743-3550ee831e52 Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com>
Done in commit |
Agent-Logs-Url: https://github.com/pubkey/rxdb/sessions/38712f80-ffdb-41bb-b70d-88948cbe660a Co-authored-by: pubkey <8926560+pubkey@users.noreply.github.com>
Fixed in commit The correct fix (as TypeScript itself suggests in the error message) is to use Also removed the broken |
Problem
scripts/fix-types.mjspreviously only converted bare.tsimport specifiers to.d.tsindist/types/index.d.ts. All other generated.d.tsfiles (e.g.rx-document.d.ts,rx-collection.d.ts,rx-query.d.ts, and all plugin declaration files) still contained unresolvable.tsextension imports such as:When consumers use
moduleResolution: "bundler"(the default for Angular 20+), TypeScript resolves.tsextension specifiers exactly — it does not fall back to.d.ts. These broken specifiers cause the referenced types to degrade toany/unknown, which is how Angular template type checker loses theSignal<T>type for$$andfield$$reactive properties.Fix
Extended
scripts/fix-types.mjsto:.d.tsfiles underdist/types/dist/types/types/subdirectory (which already uses correct.d.tsspecifiers).ts→.d.tsconversion to every collected file// @ts-nocheckonly ondist/types/index.d.ts(as before)Updated the Angular example to demonstrate and verify correct Signal typing with
AngularSignalReactivityLambda:examples/angular/src/app/RxDB.d.ts— switched fromSignal<unknown>toAngularSignalReactivityLambdasodoc.field$$resolves toSignal<FieldType>instead ofSignal<unknown>examples/angular/src/app/services/database.service.ts— passesAngularSignalReactivityLambdaas the Reactivity generic tocreateRxDatabaseexamples/angular/src/app/components/heroes-list/heroes-list.component.ts—heroCount$$is now typed asSignal<number>examples/angular/src/app/typings-test.ts(new) — type-check file asserting thatdoc.name$$→Signal<string>,doc.hp$$→Signal<number>,count().$$→Signal<number>,find().$$→Signal<RxHeroDocument[]>, etc.examples/angular/tsconfig.json— enabledstrictTemplates: true(replacesfullTemplateTypeCheck) so Angular's template type checker enforces strict typing in component templatestest/typings.test.ts— added#8488 AngularSignalReactivityLambdatest with explicitSignal<T>type assertions, verified bynpm run test:typingsVerification
npm run lint— passesnpm run check-types— no errors insrc/npm run build— succeedsnpm run test:fast:memory— 1353 tests passingnpm run test:typings— passes with new Angular Signal type assertions