Type definitions for the TypeScript-ESTree AST specification, including parser options and AST node types
—
Union type defining all available TypeScript library targets for compilation and type checking. These library targets control which built-in type definitions are available during TypeScript compilation.
Complete union type of all TypeScript library targets.
type Lib =
// Core ECMAScript libraries
| 'es5'
| 'es6'
| 'es7'
| 'es2015'
| 'es2015.collection'
| 'es2015.core'
| 'es2015.generator'
| 'es2015.iterable'
| 'es2015.promise'
| 'es2015.proxy'
| 'es2015.reflect'
| 'es2015.symbol'
| 'es2015.symbol.wellknown'
| 'es2016'
| 'es2016.array.include'
| 'es2016.full'
| 'es2016.intl'
| 'es2017'
| 'es2017.arraybuffer'
| 'es2017.date'
| 'es2017.full'
| 'es2017.intl'
| 'es2017.object'
| 'es2017.sharedmemory'
| 'es2017.string'
| 'es2017.typedarrays'
| 'es2018'
| 'es2018.asyncgenerator'
| 'es2018.asynciterable'
| 'es2018.full'
| 'es2018.intl'
| 'es2018.promise'
| 'es2018.regexp'
| 'es2019'
| 'es2019.array'
| 'es2019.full'
| 'es2019.intl'
| 'es2019.object'
| 'es2019.string'
| 'es2019.symbol'
| 'es2020'
| 'es2020.bigint'
| 'es2020.date'
| 'es2020.full'
| 'es2020.intl'
| 'es2020.number'
| 'es2020.promise'
| 'es2020.sharedmemory'
| 'es2020.string'
| 'es2020.symbol.wellknown'
| 'es2021'
| 'es2021.full'
| 'es2021.intl'
| 'es2021.promise'
| 'es2021.string'
| 'es2021.weakref'
| 'es2022'
| 'es2022.array'
| 'es2022.error'
| 'es2022.full'
| 'es2022.intl'
| 'es2022.object'
| 'es2022.regexp'
| 'es2022.string'
| 'es2023'
| 'es2023.array'
| 'es2023.collection'
| 'es2023.full'
| 'es2023.intl'
| 'es2024'
| 'es2024.arraybuffer'
| 'es2024.collection'
| 'es2024.full'
| 'es2024.object'
| 'es2024.promise'
| 'es2024.regexp'
| 'es2024.sharedmemory'
| 'es2024.string'
| 'esnext'
| 'esnext.array'
| 'esnext.asynciterable'
| 'esnext.bigint'
| 'esnext.collection'
| 'esnext.decorators'
| 'esnext.disposable'
| 'esnext.error'
| 'esnext.float16'
| 'esnext.full'
| 'esnext.intl'
| 'esnext.iterator'
| 'esnext.object'
| 'esnext.promise'
| 'esnext.regexp'
| 'esnext.sharedmemory'
| 'esnext.string'
| 'esnext.symbol'
| 'esnext.weakref'
// Platform libraries
| 'dom'
| 'dom.asynciterable'
| 'dom.iterable'
| 'webworker'
| 'webworker.asynciterable'
| 'webworker.importscripts'
| 'webworker.iterable'
| 'scripthost'
// Feature libraries
| 'decorators'
| 'decorators.legacy'
| 'lib';Usage Examples:
import { Lib, ParserOptions } from "@typescript-eslint/types";
// Basic modern web application
const webAppLibs: Lib[] = [
'es2022',
'dom',
'dom.iterable'
];
// Node.js server application
const nodeAppLibs: Lib[] = [
'es2021',
'es2021.promise'
];
// Configure parser with specific libraries
const parserOptions: ParserOptions = {
lib: [
'es2023', // Latest stable ECMAScript features
'dom', // Browser DOM APIs
'dom.iterable', // Iterable DOM collections
'webworker', // Web Worker APIs
'decorators', // Decorator support
]
};
// Check if a library is ECMAScript-related
function isECMAScriptLib(lib: Lib): boolean {
return lib.startsWith('es') || lib.startsWith('esnext');
}
// Get full feature set for a specific year
function getFullLibForYear(year: number): Lib[] {
const baseLib = `es${year}` as Lib;
const fullLib = `es${year}.full` as Lib;
return [baseLib, fullLib];
}Base ECMAScript version libraries:
Granular feature libraries for specific ECMAScript capabilities:
es2015.collection, es2023.collection - Map, Set, WeakMap, WeakSetes2015.promise, es2021.promise - Promise APIs and enhancementses2016.array.include, es2019.array, es2022.array - Array methodses2017.string, es2019.string, es2022.string - String methodses2015.symbol, es2019.symbol - Symbol functionalityes2018.asyncgenerator, es2018.asynciterable - Async iterationEnvironment-specific APIs:
dom - Browser DOM APIs (Document, Element, etc.)dom.iterable - Iterable DOM collections (NodeList, HTMLCollection)dom.asynciterable - Async iterable DOM APIswebworker - Web Worker global scopewebworker.iterable - Iterable APIs in workerswebworker.importscripts - ImportScripts functionalityscripthost - Windows Script Host APIsSpecific language features:
decorators - Stage 3 decorator proposaldecorators.legacy - Legacy experimental decoratorslib - Core library functionalityComprehensive feature sets for specific versions:
Common Library Combinations:
// Modern web application (React/Vue/Angular)
const modernWebLibs: Lib[] = [
'es2022',
'dom',
'dom.iterable',
'es2022.array',
'es2022.string'
];
// Node.js backend service
const nodeLibs: Lib[] = [
'es2021',
'es2021.promise',
'es2021.string',
'es2021.weakref'
];
// Browser extension
const extensionLibs: Lib[] = [
'es2020',
'dom',
'webworker',
'scripthost'
];
// TypeScript with decorators
const decoratorLibs: Lib[] = [
'es2023',
'decorators',
'dom'
];
// Legacy browser support
const legacyLibs: Lib[] = [
'es5',
'dom'
];
// Cutting-edge features (experimental)
const experimentalLibs: Lib[] = [
'esnext.full',
'esnext.decorators',
'esnext.disposable',
'dom'
];dom for browsers, omit for Node.jsesnext libraries carefully, prefer stable versions['es2022', 'dom', 'dom.iterable']['es2021', 'es2021.promise']['es5', 'dom']['es2023', 'decorators', 'dom']['es2020', 'webworker', 'webworker.iterable'].full libraries when possibleInstall with Tessl CLI
npx tessl i tessl/npm-typescript-eslint--types