Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Deno.CompilerOptions

UNSTABLE: new API, yet to be vetted.

A specific subset TypeScript compiler options that can be supported by the Deno TypeScript compiler.

interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
allowUmdGlobalAccess?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
baseUrl?: string;
charset?: string;
checkJs?: boolean;
declaration?: boolean;
declarationDir?: string;
declarationMap?: boolean;
downlevelIteration?: boolean;
emitDeclarationOnly?: boolean;
emitDecoratorMetadata?: boolean;
esModuleInterop?: boolean;
experimentalDecorators?: boolean;
importHelpers?: boolean;
importsNotUsedAsValues?: "remove" | "preserve" | "error";
inlineSourceMap?: boolean;
inlineSources?: boolean;
jsx?:
| "react"
| "preserve"
| "react-native"
| "react-jsx"
| "react-jsx-dev";
jsxFactory?: string;
jsxFragmentFactory?: string;
jsxImportSource?: string;
keyofStringsOnly?: string;
lib?: string[];
locale?: string;
mapRoot?: string;
module?:
| "none"
| "commonjs"
| "amd"
| "system"
| "umd"
| "es6"
| "es2015"
| "es2020"
| "esnext";
noEmitHelpers?: boolean;
noFallthroughCasesInSwitch?: boolean;
noImplicitAny?: boolean;
noImplicitReturns?: boolean;
noImplicitThis?: boolean;
noImplicitUseStrict?: boolean;
noLib?: boolean;
noResolve?: boolean;
noStrictGenericChecks?: boolean;
noUncheckedIndexedAccess?: boolean;
noUnusedLocals?: boolean;
noUnusedParameters?: boolean;
paths?: Record<string, string[]>;
preserveConstEnums?: boolean;
removeComments?: boolean;
rootDir?: string;
rootDirs?: string[];
skipLibCheck?: boolean;
sourceMap?: boolean;
sourceRoot?: string;
strict?: boolean;
strictBindCallApply?: boolean;
strictFunctionTypes?: boolean;
strictNullChecks?: boolean;
strictPropertyInitialization?: boolean;
suppressExcessPropertyErrors?: boolean;
suppressImplicitAnyIndexErrors?: boolean;
target?:
| "es3"
| "es5"
| "es6"
| "es2015"
| "es2016"
| "es2017"
| "es2018"
| "es2019"
| "es2020"
| "esnext";
types?: string[];
useDefineForClassFields?: boolean;
}

§Properties

§
allowJs?: boolean
[src]

Allow JavaScript files to be compiled. Defaults to true.

§
allowSyntheticDefaultImports?: boolean
[src]

Allow default imports from modules with no default export. This does not affect code emit, just typechecking. Defaults to false.

§
allowUmdGlobalAccess?: boolean
[src]

Allow accessing UMD globals from modules. Defaults to false.

§
allowUnreachableCode?: boolean
[src]

Do not report errors on unreachable code. Defaults to false.

§
allowUnusedLabels?: boolean
[src]

Do not report errors on unused labels. Defaults to false

§
alwaysStrict?: boolean
[src]

Parse in strict mode and emit "use strict" for each source file. Defaults to true.

§
baseUrl?: string
[src]

Base directory to resolve non-relative module names. Defaults to undefined.

§
charset?: string
[src]

The character set of the input files. Defaults to "utf8".

§
checkJs?: boolean
[src]

Report errors in .js files. Use in conjunction with allowJs. Defaults to false.

§
declaration?: boolean
[src]

Generates corresponding .d.ts file. Defaults to false.

§
declarationDir?: string
[src]

Output directory for generated declaration files.

§
declarationMap?: boolean
[src]

Generates a source map for each corresponding .d.ts file. Defaults to false.

§
downlevelIteration?: boolean
[src]

Provide full support for iterables in for..of, spread and destructuring when targeting ES5 or ES3. Defaults to false.

§
emitDeclarationOnly?: boolean
[src]

Only emit .d.ts declaration files. Defaults to false.

§
emitDecoratorMetadata?: boolean
[src]

Emit design-type metadata for decorated declarations in source. See issue microsoft/TypeScript#2577 for details. Defaults to false.

§
esModuleInterop?: boolean
[src]

Emit __importStar and __importDefault helpers for runtime babel ecosystem compatibility and enable allowSyntheticDefaultImports for type system compatibility. Defaults to true.

§
experimentalDecorators?: boolean
[src]

Enables experimental support for ES decorators. Defaults to true.

§
importHelpers?: boolean
[src]

Import emit helpers (e.g. __extends, __rest, etc..) from tslib.

§
importsNotUsedAsValues?: "remove" | "preserve" | "error"
[src]

This flag controls how import works, there are 3 different options:

  • remove: The default behavior of dropping import statements which only reference types.
  • preserve: Preserves all import statements whose values or types are never used. This can cause imports/side-effects to be preserved.
  • error: This preserves all imports (the same as the preserve option), but will error when a value import is only used as a type. This might be useful if you want to ensure no values are being accidentally imported, but still make side-effect imports explicit.

This flag works because you can use import type to explicitly create an import statement which should never be emitted into JavaScript.

§
inlineSourceMap?: boolean
[src]

Emit a single file with source maps instead of having a separate file. Defaults to false.

§
inlineSources?: boolean
[src]

Emit the source alongside the source maps within a single file; requires inlineSourceMap or sourceMap to be set. Defaults to false.

§
jsx?: "react" | "preserve" | "react-native" | "react-jsx" | "react-jsx-dev"
[src]

Support JSX in .tsx files: "react", "preserve", "react-native", "react-jsx", "react-jsxdev". Defaults to "react"`.

§
jsxFactory?: string
[src]

Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h. Defaults to React.createElement.

§
jsxFragmentFactory?: string
[src]

Specify the JSX fragment factory function to use when targeting react JSX emit, e.g. Fragment. Defaults to React.Fragment.

§
jsxImportSource?: string
[src]

Declares the module specifier to be used for importing the jsx and jsxs factory functions when using jsx as "react-jsx" or "react-jsxdev". Defaults to "react".

§
keyofStringsOnly?: string
[src]

Resolve keyof to string valued property names only (no numbers or symbols). Defaults to false.

§
lib?: string[]
[src]

List of library files to be included in the compilation. If omitted, then the Deno main runtime libs are used.

§
locale?: string
[src]

The locale to use to show error messages.

§
mapRoot?: string
[src]

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.

§
module?: "none" | "commonjs" | "amd" | "system" | "umd" | "es6" | "es2015" | "es2020" | "esnext"
[src]

Specify the module format for the emitted code. Defaults to "esnext".

§
noEmitHelpers?: boolean
[src]

Do not generate custom helper functions like __extends in compiled output. Defaults to false.

§
noFallthroughCasesInSwitch?: boolean
[src]

Report errors for fallthrough cases in switch statement. Defaults to false.

§
noImplicitAny?: boolean
[src]

Raise error on expressions and declarations with an implied any type. Defaults to true.

§
noImplicitReturns?: boolean
[src]

Report an error when not all code paths in function return a value. Defaults to false.

§
noImplicitThis?: boolean
[src]

Raise error on this expressions with an implied any type. Defaults to true.

§
noImplicitUseStrict?: boolean
[src]

Do not emit "use strict" directives in module output. Defaults to false.

§
noLib?: boolean
[src]

Do not include the default library file (lib.d.ts). Defaults to false.

§
noResolve?: boolean
[src]

Do not add triple-slash references or module import targets to the list of compiled files. Defaults to false.

§
noStrictGenericChecks?: boolean
[src]

Disable strict checking of generic signatures in function types. Defaults to false.

§
noUncheckedIndexedAccess?: boolean
[src]

Include 'undefined' in index signature results. Defaults to false.

§
noUnusedLocals?: boolean
[src]

Report errors on unused locals. Defaults to false.

§
noUnusedParameters?: boolean
[src]

Report errors on unused parameters. Defaults to false.

§
paths?: Record<string, string[]>
[src]

List of path mapping entries for module names to locations relative to the baseUrl. Defaults to undefined.

§
preserveConstEnums?: boolean
[src]

Do not erase const enum declarations in generated code. Defaults to false.

§
removeComments?: boolean
[src]

Remove all comments except copy-right header comments beginning with /*!. Defaults to true.

§
rootDir?: string
[src]

Specifies the root directory of input files. Only use to control the output directory structure with outDir. Defaults to undefined.

§
rootDirs?: string[]
[src]

List of root folders whose combined content represent the structure of the project at runtime. Defaults to undefined.

§
skipLibCheck?: boolean
[src]

Skip type checking of all declaration files (*.d.ts).

§
sourceMap?: boolean
[src]

Generates corresponding .map file. Defaults to false.

§
sourceRoot?: string
[src]

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.

§
strict?: boolean
[src]

Enable all strict type checking options. Enabling strict enables noImplicitAny, noImplicitThis, alwaysStrict, strictBindCallApply, strictNullChecks, strictFunctionTypes and strictPropertyInitialization. Defaults to true.

§
strictBindCallApply?: boolean
[src]

Enable stricter checking of the bind, call, and apply methods on functions. Defaults to true.

§
strictFunctionTypes?: boolean
[src]

Disable bivariant parameter checking for function types. Defaults to true.

§
strictNullChecks?: boolean
[src]

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).

§
strictPropertyInitialization?: boolean
[src]

Ensure non-undefined class properties are initialized in the constructor. This option requires strictNullChecks be enabled in order to take effect. Defaults to true.

§
suppressExcessPropertyErrors?: boolean
[src]

Suppress excess property checks for object literals. Defaults to false.

§
suppressImplicitAnyIndexErrors?: boolean
[src]

Suppress noImplicitAny errors for indexing objects lacking index signatures.

§
target?: "es3" | "es5" | "es6" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "esnext"
[src]

Specify ECMAScript target version. Defaults to esnext.

§
types?: string[]
[src]

List of names of type definitions to include when type checking. Defaults to undefined.

The type definitions are resolved according to the normal Deno resolution irrespective of if sources are provided on the call. In addition, unlike passing the --config option on startup, there is no base to resolve relative specifiers, so the specifiers here have to be fully qualified URLs or paths. For example:

Deno.emit("./a.ts", {
  compilerOptions: {
    types: [
      "https://deno.land/x/pkg/types.d.ts",
      "/Users/me/pkg/types.d.ts",
    ]
  }
});
§
useDefineForClassFields?: boolean
[src]

Emit class fields with ECMAScript-standard semantics. Defaults to false.