Angular 20 strict import strategy and rxjs types #7568
Peanuts-83
started this conversation in
Report issues other than bug
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can't auto-import rxjs operators in Angular 20 projects from IDE (vsCode)
Alert provided
Could not find a declaration file for module 'rxjs'. '/home/thomasranque/dev/depot/ng-emedisys/node_modules/rxjs/dist/esm5/index.js' implicitly has an 'any' type.
There are types at '/home/thomasranque/dev/depot/ng-emedisys/node_modules/rxjs/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'rxjs' library may need to update its package.json or typings.ts(7016)
This error message means that TypeScript cannot properly find the type declaration files (.d.ts) for the rxjs module, due to the way "exports" is configured in the rxjs package’s package.json.
Technical explanation
TypeScript is looking for types in index.d.ts.
With Angular 20 and Node 20+, module resolution strictly follows the "exports" field in each dependency’s package.json.
If "exports" does not explicitly expose the type files, TypeScript cannot use them—even if they exist physically.
Why does this happen now?
Angular 20 and Node 20+ enforce strict module and type resolution.
Many libraries (including RxJS) have not yet updated their package.json to properly expose their types via "exports".
Possible solutions
Wait for an official update from RxJS
The RxJS maintainers need to fix their package.json to expose the types.
Temporary patch
You can try adding "types" to the "exports" section of RxJS’s package.json:
Beta Was this translation helpful? Give feedback.
All reactions