import { type Deno } from "https://deno.land/x/deno@v1.0.0/cli/js/lib.deno.unstable.d.ts";
const { CompilerOptions } = Deno;
UNSTABLE: new API, yet to be vetted.
A specific subset TypeScript compiler options that can be supported by the Deno TypeScript compiler.
Properties
Allow default imports from modules with no default export. This does not
affect code emit, just typechecking. Defaults to false
.
Parse in strict mode and emit "use strict"
for each source file.
Defaults to true
.
Report errors in .js
files. Use in conjunction with allowJs
. Defaults
to false
.
Generates a source map for each corresponding .d.ts
file. Defaults to
false
.
Provide full support for iterables in for..of
, spread and
destructuring when targeting ES5 or ES3. Defaults to false
.
Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
Defaults to false
.
Emit design-type metadata for decorated declarations in source. See issue
microsoft/TypeScript#2577
for details. Defaults to false
.
Emit __importStar
and __importDefault
helpers for runtime babel
ecosystem compatibility and enable allowSyntheticDefaultImports
for type
system compatibility. Defaults to true
.
Enables experimental support for ES decorators. Defaults to false
.
Emit a single file with source maps instead of having a separate file.
Defaults to false
.
Emit the source alongside the source maps within a single file; requires
inlineSourceMap
or sourceMap
to be set. Defaults to false
.
Perform additional checks to ensure that transpile only would be safe.
Defaults to false
.
Support JSX in .tsx
files: "react"
, "preserve"
, "react-native"
.
Defaults to "react"
.
Specify the JSX factory function to use when targeting react JSX emit,
e.g. React.createElement
or h
. Defaults to React.createElement
.
Resolve keyof to string valued property names only (no numbers or
symbols). Defaults to false
.
Emit class fields with ECMAScript-standard semantics. Defaults to false
.
Does not apply to "esnext"
target.
List of library files to be included in the compilation. If omitted, then the Deno main runtime libs are used.
Specifies the location where debugger should locate map files instead of
generated locations. Use this flag if the .map
files will be located at
run-time in a different location than the .js
files. The location
specified will be embedded in the source map to direct the debugger where
the map files will be located. Defaults to undefined
.
Specify the module format for the emitted code. Defaults to
"esnext"
.
Do not generate custom helper functions like __extends
in compiled
output. Defaults to false
.
Report errors for fallthrough cases in switch statement. Defaults to
false
.
Raise error on expressions and declarations with an implied any type.
Defaults to true
.
Report an error when not all code paths in function return a value.
Defaults to false
.
Raise error on this
expressions with an implied any
type. Defaults to
true
.
Do not emit "use strict"
directives in module output. Defaults to
false
.
Do not add triple-slash references or module import targets to the list of
compiled files. Defaults to false
.
Disable strict checking of generic signatures in function types. Defaults
to false
.
Redirect output structure to the directory. This only impacts
Deno.compile
and only changes the emitted file names. Defaults to
undefined
.
List of path mapping entries for module names to locations relative to the
baseUrl
. Defaults to undefined
.
Do not erase const enum declarations in generated code. Defaults to
false
.
Remove all comments except copy-right header comments beginning with
/*!
. Defaults to true
.
Specifies the root directory of input files. Only use to control the
output directory structure with outDir
. Defaults to undefined
.
List of root folders whose combined content represent the structure of
the project at runtime. Defaults to undefined
.
Specifies the location where debugger should locate TypeScript files
instead of source locations. Use this flag if the sources will be located
at run-time in a different location than that at design-time. The location
specified will be embedded in the sourceMap to direct the debugger where
the source files will be located. Defaults to undefined
.
Enable all strict type checking options. Enabling strict
enables
noImplicitAny
, noImplicitThis
, alwaysStrict
, strictBindCallApply
,
strictNullChecks
, strictFunctionTypes
and
strictPropertyInitialization
. Defaults to true
.
Enable stricter checking of the bind
, call
, and apply
methods on
functions. Defaults to true
.
Disable bivariant parameter checking for function types. Defaults to
true
.
Ensure non-undefined class properties are initialized in the constructor.
This option requires strictNullChecks
be enabled in order to take effect.
Defaults to true
.
In strict null checking mode, the null
and undefined
values are not in
the domain of every type and are only assignable to themselves and any
(the one exception being that undefined
is also assignable to void
).
Suppress excess property checks for object literals. Defaults to
false
.
Suppress noImplicitAny
errors for indexing objects lacking index
signatures.
Specify ECMAScript target version. Defaults to esnext
.
List of names of type definitions to include. Defaults to undefined
.
The type definitions are resolved according to the normal Deno resolution irrespective of if sources are provided on the call. Like other Deno modules, there is no "magical" resolution. For example:
Deno.compile(
"./foo.js",
undefined,
{
types: [ "./foo.d.ts", "https://deno.land/x/example/types.d.ts" ]
}
);