diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 6df0a8d4997..b08d897b35c 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -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, 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;