From 4d39e118a503ca80d517aee746e814a54b9c8521 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Fri, 30 Oct 2020 17:41:08 +0100 Subject: [PATCH] fix(material/datepicker): range input emitters not picked up by language service The `dateChange` and `dateInput` outputs are inherited through a mixin which seems to prevent the language service from picking them up. These changes add extra hints to the component metadata. Fixes #20932. --- src/material/datepicker/date-range-input-parts.ts | 10 ++++++++-- tools/public_api_guard/material/datepicker.d.ts | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/material/datepicker/date-range-input-parts.ts b/src/material/datepicker/date-range-input-parts.ts index 97778d9a8fb2..b18484d87382 100644 --- a/src/material/datepicker/date-range-input-parts.ts +++ b/src/material/datepicker/date-range-input-parts.ts @@ -195,7 +195,10 @@ const _MatDateRangeInputBase: providers: [ {provide: NG_VALUE_ACCESSOR, useExisting: MatStartDate, multi: true}, {provide: NG_VALIDATORS, useExisting: MatStartDate, multi: true} - ] + ], + // These need to be specified explicitly, because some tooling doesn't + // seem to pick them up from the base class. See #20932. + outputs: ['dateChange', 'dateInput'] }) export class MatStartDate extends _MatDateRangeInputBase implements CanUpdateErrorState, DoCheck, OnInit { @@ -301,7 +304,10 @@ export class MatStartDate extends _MatDateRangeInputBase implements providers: [ {provide: NG_VALUE_ACCESSOR, useExisting: MatEndDate, multi: true}, {provide: NG_VALIDATORS, useExisting: MatEndDate, multi: true} - ] + ], + // These need to be specified explicitly, because some tooling doesn't + // seem to pick them up from the base class. See #20932. + outputs: ['dateChange', 'dateInput'] }) export class MatEndDate extends _MatDateRangeInputBase implements CanUpdateErrorState, DoCheck, OnInit { diff --git a/tools/public_api_guard/material/datepicker.d.ts b/tools/public_api_guard/material/datepicker.d.ts index d786c408d45a..2967025bf47f 100644 --- a/tools/public_api_guard/material/datepicker.d.ts +++ b/tools/public_api_guard/material/datepicker.d.ts @@ -380,7 +380,7 @@ export declare class MatEndDate extends _MatDateRangeInputBase implements ngDoCheck(): void; ngOnInit(): void; static ngAcceptInputType_disabled: BooleanInput; - static ɵdir: i0.ɵɵDirectiveDefWithMeta, "input[matEndDate]", never, {}, {}, never>; + static ɵdir: i0.ɵɵDirectiveDefWithMeta, "input[matEndDate]", never, {}, { "dateChange": "dateChange"; "dateInput": "dateInput"; }, never>; static ɵfac: i0.ɵɵFactoryDef, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>; } @@ -490,7 +490,7 @@ export declare class MatStartDate extends _MatDateRangeInputBase implement ngDoCheck(): void; ngOnInit(): void; static ngAcceptInputType_disabled: BooleanInput; - static ɵdir: i0.ɵɵDirectiveDefWithMeta, "input[matStartDate]", never, {}, {}, never>; + static ɵdir: i0.ɵɵDirectiveDefWithMeta, "input[matStartDate]", never, {}, { "dateChange": "dateChange"; "dateInput": "dateInput"; }, never>; static ɵfac: i0.ɵɵFactoryDef, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }]>; }