From 4951ef12c9c5dcb8f39974a1a76e17420ddb4a19 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 4 May 2021 18:53:36 +1000 Subject: [PATCH] fix properties missing from generated Svelte .d.ts files They're currently being set to 'any', as we're not providing the dependencies to the tsc invocation. Older Anki versions had the same issue, and we'll want to fix that as well, but for now this at least restores the missing props. --- ts/svelte/svelte.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/svelte/svelte.ts b/ts/svelte/svelte.ts index 41431aa46..734053424 100644 --- a/ts/svelte/svelte.ts +++ b/ts/svelte/svelte.ts @@ -97,7 +97,7 @@ function compile(tsPath: string, tsLibs: string[]) { const createdFiles = {}; tsHost.writeFile = (fileName, contents) => (createdFiles[fileName] = contents); program.emit(undefined /* all files */, tsHost.writeFile); - return createdFiles[parsedCommandLine.fileNames[0].replace(".ts", ".d.ts")]; + return createdFiles[parsedCommandLine.fileNames[0].replace(".tsx", ".d.ts")]; } function writeFile(file, data): Promise { @@ -186,7 +186,7 @@ async function compileSvelte(args) { const [sveltePath, mjsPath, dtsPath, cssPath, binDir, genDir, ...tsLibs] = args; const svelteSource = (await readFile(sveltePath)) as string; - const mockTsPath = sveltePath + ".ts"; + const mockTsPath = sveltePath + ".tsx"; writeTs(svelteSource, sveltePath, mockTsPath); await writeDts(mockTsPath, dtsPath, tsLibs); await writeJs(svelteSource, sveltePath, mjsPath, cssPath, binDir, genDir);