From 983c540191b5d838e19863c1e722170be6ea42e3 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Thu, 17 Jun 2021 13:10:34 +0100 Subject: [PATCH] docs: fix pipe params (#42593) The addition of overloads to some of the number pipes caused the documentation to lose the parameter descriptions. This change fixes that by moving the JSDOC block in from of the primary method signature, rather than the first overload. Fixes #42590 PR Close #42593 --- packages/common/src/pipes/number_pipe.ts | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/common/src/pipes/number_pipe.ts b/packages/common/src/pipes/number_pipe.ts index 087b176b23..307a7b443b 100644 --- a/packages/common/src/pipes/number_pipe.ts +++ b/packages/common/src/pipes/number_pipe.ts @@ -79,10 +79,10 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error'; @Pipe({name: 'number'}) export class DecimalPipe implements PipeTransform { constructor(@Inject(LOCALE_ID) private _locale: string) {} + transform(value: number|string, digitsInfo?: string, locale?: string): string|null; transform(value: null|undefined, digitsInfo?: string, locale?: string): null; transform(value: number|string|null|undefined, digitsInfo?: string, locale?: string): string|null; - /** * @param value The value to be formatted. * @param digitsInfo Sets digit and decimal representation. @@ -129,6 +129,9 @@ export class DecimalPipe implements PipeTransform { export class PercentPipe implements PipeTransform { constructor(@Inject(LOCALE_ID) private _locale: string) {} + transform(value: number|string, digitsInfo?: string, locale?: string): string|null; + transform(value: null|undefined, digitsInfo?: string, locale?: string): null; + transform(value: number|string|null|undefined, digitsInfo?: string, locale?: string): string|null; /** * * @param value The number to be formatted as a percentage. @@ -145,9 +148,6 @@ export class PercentPipe implements PipeTransform { * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). */ - transform(value: number|string, digitsInfo?: string, locale?: string): string|null; - transform(value: null|undefined, digitsInfo?: string, locale?: string): null; - transform(value: number|string|null|undefined, digitsInfo?: string, locale?: string): string|null; transform(value: number|string|null|undefined, digitsInfo?: string, locale?: string): string |null { if (!isValue(value)) return null; @@ -207,6 +207,18 @@ export class CurrencyPipe implements PipeTransform { @Inject(LOCALE_ID) private _locale: string, @Inject(DEFAULT_CURRENCY_CODE) private _defaultCurrencyCode: string = 'USD') {} + transform( + value: number|string, currencyCode?: string, + display?: 'code'|'symbol'|'symbol-narrow'|string|boolean, digitsInfo?: string, + locale?: string): string|null; + transform( + value: null|undefined, currencyCode?: string, + display?: 'code'|'symbol'|'symbol-narrow'|string|boolean, digitsInfo?: string, + locale?: string): null; + transform( + value: number|string|null|undefined, currencyCode?: string, + display?: 'code'|'symbol'|'symbol-narrow'|string|boolean, digitsInfo?: string, + locale?: string): string|null; /** * * @param value The number to be formatted as currency. @@ -240,18 +252,6 @@ export class CurrencyPipe implements PipeTransform { * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). */ - transform( - value: number|string, currencyCode?: string, - display?: 'code'|'symbol'|'symbol-narrow'|string|boolean, digitsInfo?: string, - locale?: string): string|null; - transform( - value: null|undefined, currencyCode?: string, - display?: 'code'|'symbol'|'symbol-narrow'|string|boolean, digitsInfo?: string, - locale?: string): null; - transform( - value: number|string|null|undefined, currencyCode?: string, - display?: 'code'|'symbol'|'symbol-narrow'|string|boolean, digitsInfo?: string, - locale?: string): string|null; transform( value: number|string|null|undefined, currencyCode: string = this._defaultCurrencyCode, display: 'code'|'symbol'|'symbol-narrow'|string|boolean = 'symbol', digitsInfo?: string,