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.
This commit is contained in:
Damien Elmes 2021-05-04 18:53:36 +10:00
parent 6d319e8c9e
commit 4951ef12c9

View file

@ -97,7 +97,7 @@ function compile(tsPath: string, tsLibs: string[]) {
const createdFiles = {}; const createdFiles = {};
tsHost.writeFile = (fileName, contents) => (createdFiles[fileName] = contents); tsHost.writeFile = (fileName, contents) => (createdFiles[fileName] = contents);
program.emit(undefined /* all files */, tsHost.writeFile); 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<void> { function writeFile(file, data): Promise<void> {
@ -186,7 +186,7 @@ async function compileSvelte(args) {
const [sveltePath, mjsPath, dtsPath, cssPath, binDir, genDir, ...tsLibs] = args; const [sveltePath, mjsPath, dtsPath, cssPath, binDir, genDir, ...tsLibs] = args;
const svelteSource = (await readFile(sveltePath)) as string; const svelteSource = (await readFile(sveltePath)) as string;
const mockTsPath = sveltePath + ".ts"; const mockTsPath = sveltePath + ".tsx";
writeTs(svelteSource, sveltePath, mockTsPath); writeTs(svelteSource, sveltePath, mockTsPath);
await writeDts(mockTsPath, dtsPath, tsLibs); await writeDts(mockTsPath, dtsPath, tsLibs);
await writeJs(svelteSource, sveltePath, mjsPath, cssPath, binDir, genDir); await writeJs(svelteSource, sveltePath, mjsPath, cssPath, binDir, genDir);