Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/sandbox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,13 @@ export const createTypeScriptSandbox = (
}

/** Gets the results of compiling your editor's code */
const getEmitResult = async () => {
const getEmitResult = async (
emitOnlyDtsFiles?: boolean,
forceDtsEmit?: boolean
) => {
const model = editor.getModel()!
const client = await getWorkerProcess()
return await client.getEmitOutput(model.uri.toString())
return await client.getEmitOutput(model.uri.toString(), emitOnlyDtsFiles, forceDtsEmit)
}

/** Gets the JS of compiling your editor's code */
Expand All @@ -318,7 +321,7 @@ export const createTypeScriptSandbox = (

/** Gets the DTS for the JS/TS of compiling your editor's code */
const getDTSForCode = async () => {
const result = await getEmitResult()
const result = await getEmitResult(/*emitOnlyDtsFiles*/ undefined, /*forceDtsEmit*/ true)
return result.outputFiles.find((o: any) => o.name.endsWith(".d.ts"))?.text || ""
}

Expand Down
2 changes: 1 addition & 1 deletion packages/sandbox/src/tsWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export declare class TypeScriptWorker implements ts.LanguageServiceHost {
providePrefixAndSuffixTextForRename: boolean
): Promise<readonly ts.RenameLocation[] | undefined>
getRenameInfo(fileName: string, position: number, options: ts.RenameInfoOptions): Promise<ts.RenameInfo>
getEmitOutput(fileName: string): Promise<ts.EmitOutput>
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean, forceDtsEmit?: boolean): Promise<ts.EmitOutput>
getCodeFixesAtPosition(
fileName: string,
start: number,
Expand Down