mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor: add explicit types for exports relying on inferred call return type (#61312)
As part of the Bazel toolchain migration we noticed that implicit types generated by the TypeScript compiler sometimes end up referencing types from other packages (i.e. cross-package imports). These imports currently work just because the Bazel `ts_library` and `ng_module` rules automatically inserted a `<amd-module name="@angular/x" />` into `.d.ts` of packages. This helped TS figure out how to import a given file. Notably this is custom logic that is not occuring in vanilla TS or Angular compilations—so we will drop this magic as part of the toolchain cleanup! To improve code quality and keep the existing behavior working, we are doing the following: - adding a lint rule that reduces the risk of such imports breaking. The failure scenario without the rule is that API goldens show unexpected diffs, and types might be duplicated in a different package! - keeping the `<amd-module` headers, but we manually insert them into the package entry-points. This should ensure we don't regress anywhere; while we also improved general safety around this above. Long-term, isolated declarations or a lint rule from eslint-typescript can make this even more robust. PR Close #61312
This commit is contained in:
committed by
Joey Perrott
parent
dd25f3d20f
commit
810b0a7e5c
@@ -42,7 +42,7 @@ export const EMPTY_TEXT_NODE_COMMENT = 'ngetn';
|
||||
export const TEXT_NODE_SEPARATOR_COMMENT = 'ngtns';
|
||||
|
||||
export const SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';
|
||||
export const SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = SKIP_HYDRATION_ATTR_NAME.toLowerCase();
|
||||
export const SKIP_HYDRATION_ATTR_NAME_LOWER_CASE: string = SKIP_HYDRATION_ATTR_NAME.toLowerCase();
|
||||
|
||||
export const TRANSFER_STATE_TOKEN_ID = '__nghData__';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user