mirror of
https://github.com/angular/angular.git
synced 2026-11-22 22:55:25 -05:00
refactor(core): quote InputMap constraint keys on directive declarations
`getInputsTypeExpression` in `@angular/compiler` emits `'alias'`, `'required'`, and `'isSignal'` as quoted string-literal property signatures in the `InputMap` type argument of `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` on `ɵdir` and `ɵcmp`. However, `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` in `@angular/core` declared those constraint keys as unquoted identifier property signatures (`{alias: string | null; required: boolean; isSignal?: boolean}`).
In standard TypeScript, quoted and unquoted property signatures are structurally identical. When a property-renaming safety pass rewrites unquoted identifier property signatures in `.d.ts` type literals while preserving quoted string-literal keys, the renamed constraint keys on `InputMap` no longer match the quoted `'alias'`, `'required'`, and `'isSignal'` keys emitted on preprocessed `ɵdir` and `ɵcmp` source declarations, failing `TS2344`.
Quote `'alias'`, `'required'`, and `'isSignal'` in the `InputMap` constraint on `ɵɵDirectiveDeclaration` and `ɵɵComponentDeclaration` so the declaration constraints match the quoted keys emitted by `@angular/compiler`.
(cherry picked from commit 9399d67252)
This commit is contained in:
committed by
Alon Mishne
parent
1ae2753b20
commit
f53175361c
@@ -21,7 +21,7 @@ export type ɵɵDirectiveDeclaration<
|
||||
ExportAs extends string[],
|
||||
// `string` keys are for backwards compatibility with pre-16 versions.
|
||||
InputMap extends {
|
||||
[key: string]: string | {alias: string | null; required: boolean; isSignal?: boolean};
|
||||
[key: string]: string | {'alias': string | null; 'required': boolean; 'isSignal'?: boolean};
|
||||
},
|
||||
OutputMap extends {[key: string]: string},
|
||||
QueryFields extends string[],
|
||||
@@ -43,7 +43,7 @@ export type ɵɵComponentDeclaration<
|
||||
ExportAs extends string[],
|
||||
// `string` keys are for backwards compatibility with pre-16 versions.
|
||||
InputMap extends {
|
||||
[key: string]: string | {alias: string | null; required: boolean; isSignal?: boolean};
|
||||
[key: string]: string | {'alias': string | null; 'required': boolean; 'isSignal'?: boolean};
|
||||
},
|
||||
OutputMap extends {[key: string]: string},
|
||||
QueryFields extends string[],
|
||||
|
||||
Reference in New Issue
Block a user