Assert argument is provided to diagnostic (#22992)

This commit is contained in:
Andy
2018-03-29 12:28:37 -07:00
committed by GitHub
parent a9aca81601
commit e4a73f3981

View File

@@ -1570,10 +1570,10 @@ namespace ts {
}
}
export function formatStringFromArgs(text: string, args: { [index: number]: string; }, baseIndex?: number): string {
export function formatStringFromArgs(text: string, args: ArrayLike<string>, baseIndex?: number): string {
baseIndex = baseIndex || 0;
return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]);
return text.replace(/{(\d+)}/g, (_match, index?: string) => Debug.assertDefined(args[+index + baseIndex]));
}
export let localizedDiagnosticMessages: MapLike<string>;