CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-typescript-eslint--types

Type definitions for the TypeScript-ESTree AST specification, including parser options and AST node types

Pending
Overview
Eval results
Files

typescript-libraries.mddocs/

TypeScript Libraries

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.

Capabilities

Lib Type

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];
}

Library Categories

ECMAScript Core Libraries

Base ECMAScript version libraries:

  • es5: ECMAScript 5 (2009) - Basic JavaScript
  • es6/es2015: ECMAScript 2015 - Classes, modules, arrow functions
  • es2016-es2024: Annual ECMAScript releases with incremental features
  • esnext: Cutting-edge ECMAScript features (use with caution)

ECMAScript Feature Libraries

Granular feature libraries for specific ECMAScript capabilities:

  • Collection Libraries: es2015.collection, es2023.collection - Map, Set, WeakMap, WeakSet
  • Promise Libraries: es2015.promise, es2021.promise - Promise APIs and enhancements
  • Array Libraries: es2016.array.include, es2019.array, es2022.array - Array methods
  • String Libraries: es2017.string, es2019.string, es2022.string - String methods
  • Symbol Libraries: es2015.symbol, es2019.symbol - Symbol functionality
  • Async Libraries: es2018.asyncgenerator, es2018.asynciterable - Async iteration

Platform Libraries

Environment-specific APIs:

  • DOM Libraries:
    • dom - Browser DOM APIs (Document, Element, etc.)
    • dom.iterable - Iterable DOM collections (NodeList, HTMLCollection)
    • dom.asynciterable - Async iterable DOM APIs
  • Web Worker Libraries:
    • webworker - Web Worker global scope
    • webworker.iterable - Iterable APIs in workers
    • webworker.importscripts - ImportScripts functionality
  • Script Host: scripthost - Windows Script Host APIs

Feature Libraries

Specific language features:

  • Decorators:
    • decorators - Stage 3 decorator proposal
    • decorators.legacy - Legacy experimental decorators
  • Special: lib - Core library functionality

Full Libraries

Comprehensive feature sets for specific versions:

  • es2016.full, es2017.full, etc. - Complete feature set for that ECMAScript version
  • esnext.full - All cutting-edge features

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'
];

Library Selection Guidelines

Version Selection Strategy

  1. Start with base version: Choose the oldest ECMAScript version your target environments support
  2. Add specific features: Include only the feature libraries you actually use
  3. Include platform APIs: Add dom for browsers, omit for Node.js
  4. Consider future features: Use esnext libraries carefully, prefer stable versions

Common Combinations

  • Modern Web: ['es2022', 'dom', 'dom.iterable']
  • Node.js Server: ['es2021', 'es2021.promise']
  • Legacy Support: ['es5', 'dom']
  • TypeScript with Decorators: ['es2023', 'decorators', 'dom']
  • Web Worker: ['es2020', 'webworker', 'webworker.iterable']

Performance Considerations

  • Including more libraries increases TypeScript's memory usage
  • Only include libraries for APIs you actually use
  • Prefer specific feature libraries over .full libraries when possible
  • Test library combinations with your target environments

Install with Tessl CLI

npx tessl i tessl/npm-typescript-eslint--types

docs

ast-node-types.md

index.md

parser-configuration.md

token-types.md

typescript-estree.md

typescript-libraries.md

tile.json