File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 1- import { ScriptTarget , transpile as transpileTypeScript } from "typescript" ;
21import type { Cell } from "../lib/notebook.js" ;
32import { toCell } from "../lib/notebook.js" ;
43import { rewriteFileExpressions } from "./files.js" ;
@@ -8,6 +7,7 @@ import {transpileObservable} from "./observable.js";
87import { parseJavaScript } from "./parse.js" ;
98import { Sourcemap } from "./sourcemap.js" ;
109import { transpileTemplate } from "./template.js" ;
10+ import { transpileTypeScript } from "./typescript.js" ;
1111
1212export type TranspiledJavaScript = {
1313 /** the source code of a JavaScript function defining the primary variable */
@@ -57,7 +57,7 @@ export function transpile(
5757 }
5858 const transpiled =
5959 mode === "ts"
60- ? transpileJavaScript ( transpileTypeScript ( input , { target : ScriptTarget . ESNext } ) , options )
60+ ? transpileJavaScript ( transpileTypeScript ( input ) , options )
6161 : mode === "ojs"
6262 ? transpileObservable ( input , options )
6363 : mode !== "js"
Original file line number Diff line number Diff line change 1+ import { ModuleKind , ScriptTarget , transpile } from "typescript" ;
2+
3+ export function transpileTypeScript ( input : string ) : string {
4+ return transpile ( input , {
5+ target : ScriptTarget . ESNext ,
6+ module : ModuleKind . Preserve ,
7+ verbatimModuleSyntax : true
8+ } ) ;
9+ }
You can’t perform that action at this time.
0 commit comments