;\n",
3 | "extension": "jsx",
4 | "highlights": [],
5 | "queries": [],
6 | "staticQuickInfos": [],
7 | "errors": [],
8 | "playgroundURL": "https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKaiAm8APAOgBcBnAgKBFABUALaM0XAe3jMQHITQB3VgCcA1gEJK+AMaxkg+KFStcAVwSgAUgGUAGqADelUNkQl4gyMknyAognQn9AX0PHT5y-ICSJwTjLRJW3h7cn0XIwBtMiwyEl9EAHMAXSxkRABPF2dnGnAyelY+a1RoEmowcERWa0FBITJyiAArCiwABzkyMwA3eEpCNqFeSVZEWNB6eFhYVgB1IVhcUABeUAAKAEoVgD5QAB56AEZtgAkpmf4F3D3gI+3KIA",
9 | "tags": []
10 | }
11 |
--------------------------------------------------------------------------------
/packages/ts-twoslasher/test/results/unexpected_errors.json:
--------------------------------------------------------------------------------
1 |
2 | ## Errors were thrown in the sample, but not included in an errors tag
3 |
4 | These errors were not marked as being expected: 2588.
5 | Expected: // @errors: 2588
6 |
7 | Compiler Errors:
8 |
9 | index.ts
10 | [2588] 98 - Cannot assign to 'myVariable' because it is a constant.
--------------------------------------------------------------------------------
/packages/ts-twoslasher/test/results/unknown_compiler_error.json:
--------------------------------------------------------------------------------
1 |
2 | ## Invalid inline compiler flag
3 |
4 | There isn't a TypeScript compiler flag called 'targets'.
5 |
6 | This is likely a typo, you can check all the compiler flags in the TSConfig reference, or check the additional Twoslash flags in the npm page for @typescript/twoslash.
--------------------------------------------------------------------------------
/packages/ts-twoslasher/test/results/unknown_compiler_value.json:
--------------------------------------------------------------------------------
1 |
2 | ## Invalid inline compiler value
3 |
4 | Got TS2015 for target but it is not a supported value by the TS compiler.
5 |
6 | Allowed values: es3,es5,es6,es2015,es2016,es2017,es2018,es2019,es2020,es2021,es2022,es2023,es2024,esnext
--------------------------------------------------------------------------------
/packages/ts-twoslasher/test/results/unknown_extension.json:
--------------------------------------------------------------------------------
1 |
2 | ## Unknown TypeScript extension given to Twoslash
3 |
4 | Received herjk but Twoslash only accepts: js,javascript,ts,typescript,tsx,jsx,json,jsn
5 |
--------------------------------------------------------------------------------
/packages/ts-twoslasher/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "include": ["src", "types", "test"],
3 | "exclude": ["test/fixtures"],
4 | "compilerOptions": {
5 | "target": "es5",
6 | "module": "esnext",
7 | "lib": ["dom", "esnext"],
8 | "importHelpers": true,
9 | "declaration": true,
10 | "sourceMap": true,
11 | "rootDir": "./src",
12 | "strict": true,
13 | "noImplicitAny": true,
14 | "strictNullChecks": true,
15 | "strictFunctionTypes": true,
16 | "strictPropertyInitialization": true,
17 | "noImplicitThis": true,
18 | "alwaysStrict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noImplicitReturns": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "moduleResolution": "node",
24 | "baseUrl": "./src",
25 | "paths": {
26 | "*": ["src/*", "node_modules/*"]
27 | },
28 | "jsx": "react",
29 | "esModuleInterop": true
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Handled by @oss-docs/sync
3 | copy/*
4 | !copy/en
5 | **/*.js
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Additional_Checks_6176.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Linter Checks"
3 | ---
4 |
5 | A collection of extra checks, which somewhat cross the boundaries of compiler vs linter. You may prefer to use a tool like eslint over these options if you are looking for more in-depth rules.
6 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Advanced_Options_6178.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Advanced"
3 | ---
4 |
5 | Flags which help with debugging
6 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Backwards_Compatibility_6253.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Backwards Compatibility"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Basic_Options_6172.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Project Options"
3 | ---
4 |
5 | These settings are used to define the runtime expectations of your project, how and where you want the JavaScript to be emitted and the level of integration you want with existing JavaScript code.
6 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Command_line_Options_6171.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Command Line"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Compiler_Diagnostics_6251.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Compiler Diagnostics"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Completeness_6257.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Completeness"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Editor_Support_6249.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Editor Support"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Emit_6246.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Emit"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Experimental_Options_6177.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Experimental"
3 | ---
4 |
5 | TypeScript strives to only include features which are confirmed to be added into the JavaScript language.
6 |
7 | There have been cases where a feature is compelling enough to be an exception to that rule, and these live as experimental compiler flags.
8 | It is possible that a version of these features may be different when/if they are added to the JavaScript language, and thus are considered risky.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Interop_Constraints_6252.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Interop Constraints"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/JavaScript_Support_6247.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "JavaScript Support"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Language_and_Environment_6254.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Language and Environment"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Module_Resolution_Options_6174.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Module Resolution"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Modules_6244.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Modules"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Output_Formatting_6256.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Output Formatting"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Project_Files_0.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "File Inclusion"
3 | ---
4 |
5 | These settings help you ensure that TypeScript picks up the right files.
6 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Projects_6255.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Projects"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Source_Map_Options_6175.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Source Maps"
3 | ---
4 |
5 | In order to provide rich debugging tools and crash reports which make sense to developers, TypeScript supports
6 | emitting additional files which conform to the JavaScript Source Map standards.
7 |
8 | These are emitted as `.map` files which live alongside the file they represent.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Strict_Type_Checking_Options_6173.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Strict Checks"
3 | ---
4 |
5 | We recommend using the [compiler option `strict`](#strict) to opt-in to every possible improvement as they are built.
6 |
7 | TypeScript supports a wide spectrum of JavaScript patterns and defaults to allowing for quite a lot of flexibility in accommodating these styles.
8 | Often the safety and potential scalability of a codebase can be at odds with some of these techniques.
9 |
10 | Because of the variety of supported JavaScript, upgrading to a new version of TypeScript can uncover two types of errors:
11 |
12 | - Errors which already exist in your codebase, which TypeScript has uncovered because the language has refined its understanding of JavaScript.
13 | - A new suite of errors which tackle a new problem domain.
14 |
15 | TypeScript will usually add a compiler flag for the latter set of errors, and by default these are not enabled.
16 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Type_Checking_6248.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Type Checking"
3 | ---
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/categories/Watch_and_Build_Modes_6250.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Watch Options"
3 | ---
4 |
5 | TypeScript 3.8 shipped a new strategy for watching directories, which is crucial for efficiently picking up changes to `node_modules`.
6 |
7 | On operating systems like Linux, TypeScript installs directory watchers (as opposed to file watchers) on `node_modules` and many of its subdirectories to detect changes in dependencies.
8 | This is because the number of available file watchers is often eclipsed by the number of files in `node_modules`, whereas there are way fewer directories to track.
9 |
10 | Because every project might work better under different strategies, and this new approach might not work well for your workflows, TypeScript 3.8 introduces a new `watchOptions` field which allows users to tell the compiler/language service which watching strategies should be used to keep track of files and directories.
11 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/cli/help.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Help"
3 | oneline: "Gives local information for help on the CLI."
4 | ---
5 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/allowImportingTsExtensions.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Allow Importing TS Extensions"
3 | oneline: "Allow imports to include TypeScript file extensions."
4 | ---
5 |
6 | `--allowImportingTsExtensions` allows TypeScript files to import each other with a TypeScript-specific extension like `.ts`, `.mts`, or `.tsx`.
7 |
8 | This flag is only allowed when `--noEmit` or `--emitDeclarationOnly` is enabled, since these import paths would not be resolvable at runtime in JavaScript output files.
9 | The expectation here is that your resolver (e.g. your bundler, a runtime, or some other tool) is going to make these imports between `.ts` files work.
10 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/allowUmdGlobalAccess.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Allow Umd Global Access"
3 | oneline: "Allow accessing UMD globals from modules."
4 | ---
5 |
6 | When set to true, `allowUmdGlobalAccess` lets you access UMD exports as globals from inside module files. A module file is a file that has imports and/or exports. Without this flag, using an export from a UMD module requires an import declaration.
7 |
8 | An example use case for this flag would be a web project where you know the particular library (like jQuery or Lodash) will always be available at runtime, but you can’t access it with an import.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/allowUnusedLabels.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Allow Unused Labels"
3 | oneline: "Disable error reporting for unused labels."
4 | ---
5 |
6 | When:
7 |
8 | - `undefined` (default) provide suggestions as warnings to editors
9 | - `true` unused labels are ignored
10 | - `false` raises compiler errors about unused labels
11 |
12 | Labels are very rare in JavaScript and typically indicate an attempt to write an object literal:
13 |
14 | ```ts twoslash
15 | // @errors: 7028
16 | // @allowUnusedLabels: false
17 | function verifyAge(age: number) {
18 | // Forgot 'return' statement
19 | if (age > 18) {
20 | verified: true;
21 | }
22 | }
23 | ```
24 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/alwaysStrict.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Always Strict"
3 | oneline: "Ensure 'use strict' is always emitted."
4 | ---
5 |
6 | Ensures that your files are parsed in the ECMAScript strict mode, and emit "use strict" for each source file.
7 |
8 | [ECMAScript strict](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Strict_mode) mode was introduced in ES5 and provides behavior tweaks to the runtime of the JavaScript engine to improve performance, and makes a set of errors throw instead of silently ignoring them.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/assumeChangesOnlyAffectDirectDependencies.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Assume Changes Only Affect Direct Dependencies"
3 | oneline: "Have recompiles in projects that use [`incremental`](#incremental) and `watch` mode assume that changes within a file will only affect files directly depending on it."
4 | ---
5 |
6 | When this option is enabled, TypeScript will avoid rechecking/rebuilding all truly possibly-affected files, and only recheck/rebuild files that have changed as well as files that directly import them.
7 |
8 | This can be considered a 'fast & loose' implementation of the watching algorithm, which can drastically reduce incremental rebuild times at the expense of having to run the full build occasionally to get all compiler error messages.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/baseUrl.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Base URL"
3 | oneline: "Specify the base directory to resolve bare specifier module names."
4 | ---
5 |
6 | Sets a base directory from which to resolve bare specifier module names. For example, in the directory structure:
7 |
8 | ```
9 | project
10 | ├── ex.ts
11 | ├── hello
12 | │ └── world.ts
13 | └── tsconfig.json
14 | ```
15 |
16 | With `"baseUrl": "./"`, TypeScript will look for files starting at the same folder as the `tsconfig.json`:
17 |
18 | ```ts
19 | import { helloWorld } from "hello/world";
20 |
21 | console.log(helloWorld);
22 | ```
23 |
24 | This resolution has higher priority than lookups from `node_modules`.
25 |
26 | This feature was designed for use in conjunction with AMD module loaders in the browser, and is not recommended in any other context. As of TypeScript 4.1, `baseUrl` is no longer required to be set when using [`paths`](#paths).
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/charset.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Charset"
3 | oneline: "No longer supported. In early versions, manually set the text encoding for reading files."
4 | ---
5 |
6 | In prior versions of TypeScript, this controlled what encoding was used when reading text files from disk.
7 | Today, TypeScript assumes UTF-8 encoding, but will correctly detect UTF-16 (BE and LE) or UTF-8 BOMs.
8 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/clean.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Clean"
3 | oneline: "Delete the outputs of all projects."
4 | ---
5 |
6 | Delete the outputs of all projects
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/composite.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Composite"
3 | oneline: "Enable constraints that allow a TypeScript project to be used with project references."
4 | ---
5 |
6 | The `composite` option enforces certain constraints which make it possible for build tools (including TypeScript
7 | itself, under `--build` mode) to quickly determine if a project has been built yet.
8 |
9 | When this setting is on:
10 |
11 | - The [`rootDir`](#rootDir) setting, if not explicitly set, defaults to the directory containing the `tsconfig.json` file.
12 |
13 | - All implementation files must be matched by an [`include`](#include) pattern or listed in the [`files`](#files) array. If this constraint is violated, `tsc` will inform you which files weren't specified.
14 |
15 | - [`declaration`](#declaration) defaults to `true`
16 |
17 | You can find documentation on TypeScript projects in [the handbook](https://www.typescriptlang.org/docs/handbook/project-references.html).
18 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/declarationDir.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Declaration Dir"
3 | oneline: "Specify the output directory for generated declaration files."
4 | ---
5 |
6 | Offers a way to configure the root directory for where declaration files are emitted.
7 |
8 | ```
9 | example
10 | ├── index.ts
11 | ├── package.json
12 | └── tsconfig.json
13 | ```
14 |
15 | with this `tsconfig.json`:
16 |
17 | ```json tsconfig
18 | {
19 | "compilerOptions": {
20 | "declaration": true,
21 | "declarationDir": "./types"
22 | }
23 | }
24 | ```
25 |
26 | Would place the d.ts for the `index.ts` in a `types` folder:
27 |
28 | ```
29 | example
30 | ├── index.js
31 | ├── index.ts
32 | ├── package.json
33 | ├── tsconfig.json
34 | └── types
35 | └── index.d.ts
36 | ```
37 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/declarationMap.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Declaration Map"
3 | oneline: "Create sourcemaps for d.ts files."
4 | ---
5 |
6 | Generates a source map for `.d.ts` files which map back to the original `.ts` source file.
7 | This will allow editors such as VS Code to go to the original `.ts` file when using features like _Go to Definition_.
8 |
9 | You should strongly consider turning this on if you're using project references.
10 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/diagnostics.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Diagnostics"
3 | oneline: "Output compiler performance information after building."
4 | ---
5 |
6 | Used to output diagnostic information for debugging. This command is a subset of [`extendedDiagnostics`](#extendedDiagnostics) which are more user-facing results, and easier to interpret.
7 |
8 | If you have been asked by a TypeScript compiler engineer to give the results using this flag in a compile, in which there is no harm in using [`extendedDiagnostics`](#extendedDiagnostics) instead.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/disableFilenameBasedTypeAcquisition.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Disable Filename Based Type Acquisition"
3 | oneline: "Disables inference for type acquisition by looking at filenames in a project."
4 | ---
5 |
6 | TypeScript's type acquisition can infer what types should be added based on filenames in a project. This means that having a file like `jquery.js` in your project would automatically download the types for JQuery from DefinitelyTyped.
7 |
8 | You can disable this via `disableFilenameBasedTypeAcquisition`.
9 |
10 | ```json
11 | {
12 | "typeAcquisition": {
13 | "disableFilenameBasedTypeAcquisition": true
14 | }
15 | }
16 | ```
17 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/disableReferencedProjectLoad.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Disable Referenced Project Load"
3 | oneline: "Reduce the number of projects loaded automatically by TypeScript."
4 | ---
5 |
6 | In multi-project TypeScript programs, TypeScript will load all of the available projects into memory in order to provide accurate results for editor responses which require a full knowledge graph like 'Find All References'.
7 |
8 | If your project is large, you can use the flag `disableReferencedProjectLoad` to disable the automatic loading of all projects. Instead, projects are loaded dynamically as you open files through your editor.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/disableSizeLimit.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Disable Size Limit"
3 | oneline: "Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server."
4 | ---
5 |
6 | To avoid a possible memory bloat issues when working with very large JavaScript projects, there is an upper limit to the amount of memory TypeScript will allocate. Turning this flag on will remove the limit.
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/disableSolutionSearching.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Disable Solution Searching"
3 | oneline: "Opt a project out of multi-project reference checking when editing."
4 | ---
5 |
6 | When working with [composite TypeScript projects](/docs/handbook/project-references.html), this option provides a way to declare that you do not want a project to be included when using features like _find all references_ or _jump to definition_ in an editor.
7 |
8 | This flag is something you can use to increase responsiveness in large composite projects.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/disableSourceOfProjectReferenceRedirect.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Disable Source Project Reference Redirect"
3 | oneline: "Disable preferring source files instead of declaration files when referencing composite projects."
4 | ---
5 |
6 | When working with [composite TypeScript projects](/docs/handbook/project-references.html), this option provides a way to go [back to the pre-3.7](/docs/handbook/release-notes/typescript-3-7.html#build-free-editing-with-project-references) behavior where d.ts files were used to as the boundaries between modules.
7 | In 3.7 the source of truth is now your TypeScript files.
8 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/emitBOM.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Emit BOM"
3 | oneline: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."
4 | ---
5 |
6 | Controls whether TypeScript will emit a [byte order mark (BOM)](https://wikipedia.org/wiki/Byte_order_mark) when writing output files.
7 | Some runtime environments require a BOM to correctly interpret a JavaScript files; others require that it is not present.
8 | The default value of `false` is generally best unless you have a reason to change it.
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/emitDeclarationOnly.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Emit Declaration Only"
3 | oneline: "Only output d.ts files and not JavaScript files."
4 | ---
5 |
6 | _Only_ emit `.d.ts` files; do not emit `.js` files.
7 |
8 | This setting is useful in two cases:
9 |
10 | - You are using a transpiler other than TypeScript to generate your JavaScript.
11 | - You are using TypeScript to only generate `d.ts` files for your consumers.
12 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/enable.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Enable"
3 | oneline: "Disable the type acquisition for JavaScript projects."
4 | ---
5 |
6 | Disables automatic type acquisition in JavaScript projects:
7 |
8 | ```json
9 | {
10 | "typeAcquisition": {
11 | "enable": false
12 | }
13 | }
14 | ```
15 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/exclude.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Exclude"
3 | oneline: "Filters results from the [`include`](#include) option."
4 | ---
5 |
6 | Specifies an array of filenames or patterns that should be skipped when resolving [`include`](#include).
7 |
8 | **Important**: `exclude` _only_ changes which files are included as a result of the [`include`](#include) setting.
9 | A file specified by `exclude` can still become part of your codebase due to an `import` statement in your code, a `types` inclusion, a `/// `s from expanding the number of files TypeScript should add to a project."
4 | ---
5 |
6 | By default, TypeScript will examine the initial set of files for `import` and `(x: T, y: U) => [T, U];
12 | type B = (x: S, y: S) => [S, S];
13 |
14 | function f(a: A, b: B) {
15 | b = a; // Ok
16 | a = b; // Error
17 | }
18 | ```
19 |
20 | This flag can be used to remove that check.
21 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/noUnusedLocals.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "No Unused Locals"
3 | oneline: "Enable error reporting when local variables aren't read."
4 | ---
5 |
6 | Report errors on unused local variables.
7 |
8 | ```ts twoslash
9 | // @noUnusedLocals
10 | // @errors: 6133
11 | const createKeyboard = (modelID: number) => {
12 | const defaultModelID = 23;
13 | return { type: "keyboard", modelID };
14 | };
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/noUnusedParameters.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "No Unused Parameters"
3 | oneline: "Raise an error when a function parameter isn't read."
4 | ---
5 |
6 | Report errors on unused parameters in functions.
7 |
8 | ```ts twoslash
9 | // @noUnusedParameters
10 | // @errors: 6133
11 | const createDefaultKeyboard = (modelID: number) => {
12 | const defaultModelID = 23;
13 | return { type: "keyboard", modelID: defaultModelID };
14 | };
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/out.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Out"
3 | oneline: "Deprecated setting. Use [`outFile`](#outFile) instead."
4 | ---
5 |
6 | Use [`outFile`](#outFile) instead.
7 |
8 | The `out` option computes the final file location in a way that is not predictable or consistent.
9 | This option is retained for backward compatibility only and is deprecated.
10 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/outDir.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Out Dir"
3 | oneline: "Specify an output folder for all emitted files."
4 | ---
5 |
6 | If specified, `.js` (as well as `.d.ts`, `.js.map`, etc.) files will be emitted into this directory.
7 | The directory structure of the original source files is preserved; see [`rootDir`](#rootDir) if the computed root is not what you intended.
8 |
9 | If not specified, `.js` files will be emitted in the same directory as the `.ts` files they were generated from:
10 |
11 | ```sh
12 | $ tsc
13 |
14 | example
15 | ├── index.js
16 | └── index.ts
17 | ```
18 |
19 | With a `tsconfig.json` like this:
20 |
21 | ```json tsconfig
22 | {
23 | "compilerOptions": {
24 | "outDir": "dist"
25 | }
26 | }
27 | ```
28 |
29 | Running `tsc` with these settings moves the files into the specified `dist` folder:
30 |
31 | ```sh
32 | $ tsc
33 |
34 | example
35 | ├── dist
36 | │ └── index.js
37 | ├── index.ts
38 | └── tsconfig.json
39 | ```
40 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/outFile.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Out File"
3 | oneline: "Specify a file that bundles all outputs into one JavaScript file. If [`declaration`](#declaration) is true, also designates a file that bundles all .d.ts output."
4 | ---
5 |
6 | If specified, all _global_ (non-module) files will be concatenated into the single output file specified.
7 |
8 | If `module` is `system` or `amd`, all module files will also be concatenated into this file after all global content.
9 |
10 | Note: `outFile` cannot be used unless `module` is `None`, `System`, or `AMD`.
11 | This option _cannot_ be used to bundle CommonJS or ES6 modules.
12 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/preserveSymlinks.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Preserve Symlinks"
3 | oneline: "Disable resolving symlinks to their realpath. This correlates to the same flag in node."
4 | ---
5 |
6 | This is to reflect the same flag in Node.js; which does not resolve the real path of symlinks.
7 |
8 | This flag also exhibits the opposite behavior to Webpack’s `resolve.symlinks` option (i.e. setting TypeScript’s `preserveSymlinks` to true parallels setting Webpack’s `resolve.symlinks` to false, and vice-versa).
9 |
10 | With this enabled, references to modules and packages (e.g. `import`s and `/// ` directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to.
11 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/preserveWatchOutput.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Preserve Watch Output"
3 | oneline: "Disable wiping the console in watch mode."
4 | ---
5 |
6 | Whether to keep outdated console output in watch mode instead of clearing the screen every time a change happened.
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/pretty.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Pretty"
3 | oneline: "Enable color and formatting in TypeScript's output to make compiler errors easier to read."
4 | ---
5 |
6 | Stylize errors and messages using color and context, this is on by default — offers you a chance to have less terse,
7 | single colored messages from the compiler.
8 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/reactNamespace.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "React Namespace"
3 | oneline: "Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit."
4 | ---
5 |
6 | Use [`jsxFactory`](#jsxFactory) instead. Specify the object invoked for `createElement` when targeting `react` for TSX files.
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/references.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "References"
3 | oneline: "Specify an array of objects that specify paths for projects. Used in project references."
4 | ---
5 |
6 | Project references are a way to structure your TypeScript programs into smaller pieces.
7 | Using Project References can greatly improve build and editor interaction times, enforce logical separation between components, and organize your code in new and improved ways.
8 |
9 | You can read more about how references works in the [Project References](/docs/handbook/project-references.html) section of the handbook
10 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/resolvePackageJsonExports.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Resolve package.json Exports"
3 | oneline: "Use the package.json 'exports' field when resolving package imports."
4 | ---
5 |
6 | `--resolvePackageJsonExports` forces TypeScript to consult [the `exports` field of `package.json` files](https://nodejs.org/api/packages.html#exports) if it ever reads from a package in `node_modules`.
7 |
8 | This option defaults to `true` under the `node16`, `nodenext`, and `bundler` options for [`--moduleResolution`](#moduleResolution).
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/resolvePackageJsonImports.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Resolve package.json Imports"
3 | oneline: "Use the package.json 'imports' field when resolving imports."
4 | ---
5 |
6 | `--resolvePackageJsonImports` forces TypeScript to consult [the `imports` field of `package.json` files](https://nodejs.org/api/packages.html#imports) when performing a lookup that starts with `#` from a file whose ancestor directory contains a `package.json`.
7 |
8 | This option defaults to `true` under the `node16`, `nodenext`, and `bundler` options for [`--moduleResolution`](#moduleResolution).
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/rewriteRelativeImportExtensions.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "rewriteRelativeImportExtensions"
3 | oneline: "Rewrite `.ts`, `.tsx`, `.mts`, and `.cts` file extensions in relative import paths to their JavaScript equivalent in output files."
4 | ---
5 |
6 | Rewrite `.ts`, `.tsx`, `.mts`, and `.cts` file extensions in relative import paths to their JavaScript equivalent in output files.
7 |
8 | For more information, see the [TypeScript 5.7 release notes](/docs/handbook/release-notes/typescript-5-7.html#path-rewriting-for-relative-paths).
9 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/skipDefaultLibCheck.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Skip Default Lib Check"
3 | oneline: "Skip type checking .d.ts files that are included with TypeScript."
4 | ---
5 |
6 | Use [`skipLibCheck`](#skipLibCheck) instead. Skip type checking of default library declaration files.
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/sourceRoot.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Source Root"
3 | oneline: "Specify the root path for debuggers to find the reference source code."
4 | ---
5 |
6 | Specify the location where a debugger should locate TypeScript files instead of relative source locations.
7 | This string is treated verbatim inside the source-map where you can use a path or a URL:
8 |
9 | ```json tsconfig
10 | {
11 | "compilerOptions": {
12 | "sourceMap": true,
13 | "sourceRoot": "https://my-website.com/debug/source/"
14 | }
15 | }
16 | ```
17 |
18 | Would declare that `index.js` will have a source file at `https://my-website.com/debug/source/index.ts`.
19 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/stopBuildOnErrors.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "stopBuildOnErrors"
3 | oneline: "Skip building downstream projects on error in upstream project."
4 | ---
5 | Skip building downstream projects on error in upstream project.
6 |
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/strict.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Strict"
3 | oneline: "Enable all strict type-checking options."
4 | ---
5 |
6 | The `strict` flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness.
7 | Turning this on is equivalent to enabling all of the _strict mode family_ options, which are outlined below.
8 | You can then turn off individual strict mode family checks as needed.
9 |
10 | Future versions of TypeScript may introduce additional stricter checking under this flag, so upgrades of TypeScript might result in new type errors in your program.
11 | When appropriate and possible, a corresponding flag will be added to disable that behavior.
12 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/strictBuiltinIteratorReturn.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "strictBuiltinIteratorReturn"
3 | oneline: "Built-in iterators are instantiated with a TReturn type of undefined instead of any."
4 | ---
5 | Built-in iterators are instantiated with a `TReturn` type of undefined instead of `any`.
6 |
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/strictPropertyInitialization.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Strict Property Initialization"
3 | oneline: "Check for class properties that are declared but not set in the constructor."
4 | ---
5 |
6 | When set to true, TypeScript will raise an error when a class property was declared but not set in the constructor.
7 |
8 | ```ts twoslash
9 | // @errors: 2564
10 | class UserAccount {
11 | name: string;
12 | accountType = "user";
13 |
14 | email: string;
15 | address: string | undefined;
16 |
17 | constructor(name: string) {
18 | this.name = name;
19 | // Note that this.email is not set
20 | }
21 | }
22 | ```
23 |
24 | In the above case:
25 |
26 | - `this.name` is set specifically.
27 | - `this.accountType` is set by default.
28 | - `this.email` is not set and raises an error.
29 | - `this.address` is declared as potentially `undefined` which means it does not have to be set.
30 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/suppressExcessPropertyErrors.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Suppress Excess Property Errors"
3 | oneline: "Disable reporting of excess property errors during the creation of object literals."
4 | ---
5 |
6 | This disables reporting of excess property errors, such as the one shown in the following example:
7 |
8 | ```ts twoslash
9 | // @errors: 2322
10 | type Point = { x: number; y: number };
11 | const p: Point = { x: 1, y: 3, m: 10 };
12 | ```
13 |
14 | This flag was added to help people migrate to the stricter checking of new object literals in [TypeScript 1.6](/docs/handbook/release-notes/typescript-1-6.html#stricter-object-literal-assignment-checks).
15 |
16 | We don't recommend using this flag in a modern codebase, you can suppress one-off cases where you need it using `// @ts-ignore`.
17 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/suppressImplicitAnyIndexErrors.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Suppress Implicit Any Index Errors"
3 | oneline: "Suppress [`noImplicitAny`](#noImplicitAny) errors when indexing objects that lack index signatures."
4 | ---
5 |
6 | Turning `suppressImplicitAnyIndexErrors` on suppresses reporting the error about implicit anys when indexing into objects, as shown in the following example:
7 |
8 | ```ts twoslash
9 | // @noImplicitAny: true
10 | // @suppressImplicitAnyIndexErrors: false
11 | // @strict: true
12 | // @errors: 7053
13 | const obj = { x: 10 };
14 | console.log(obj["foo"]);
15 | ```
16 |
17 | Using `suppressImplicitAnyIndexErrors` is quite a drastic approach. It is recommended to use a `@ts-ignore` comment instead:
18 |
19 | ```ts twoslash
20 | // @noImplicitAny: true
21 | // @strict: true
22 | const obj = { x: 10 };
23 | // @ts-ignore
24 | console.log(obj["foo"]);
25 | ```
26 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/synchronousWatchDirectory.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Synchronous Watch Directory"
3 | oneline: "Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively."
4 | ---
5 |
6 | Synchronously call callbacks and update the state of directory watchers on platforms that don`t support recursive watching natively. Instead of giving a small timeout to allow for potentially multiple edits to occur on a file.
7 |
8 | ```json tsconfig
9 | {
10 | "watchOptions": {
11 | "synchronousWatchDirectory": true
12 | }
13 | }
14 | ```
15 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/traceResolution.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Trace Resolution"
3 | oneline: "Log paths used during the [`moduleResolution`](#moduleResolution) process."
4 | ---
5 |
6 | When you are trying to debug why a module isn't being included.
7 | You can set `traceResolution` to `true` to have TypeScript print information about its resolution process for each processed file.
8 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/typeAcquisition/exclude.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Exclude"
3 | oneline: "Specify a list of modules which to exclude from type acquisition."
4 | ---
5 |
6 | Offers a config for disabling the type-acquisition for a certain module in JavaScript projects. This can be useful for projects which include other libraries in testing infrastructure which aren't needed in the main application.
7 |
8 | ```json
9 | {
10 | "typeAcquisition": {
11 | "exclude": ["jest", "mocha"]
12 | }
13 | }
14 | ```
15 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/typeAcquisition/include.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Include"
3 | oneline: "Specify a list of modules which to acquire types for."
4 | ---
5 |
6 | If you have a JavaScript project where TypeScript needs additional guidance to understand global dependencies, or have disabled the built-in inference via [`disableFilenameBasedTypeAcquisition`](#disableFilenameBasedTypeAcquisition).
7 |
8 | You can use `include` to specify which types should be used from DefinitelyTyped:
9 |
10 | ```json
11 | {
12 | "typeAcquisition": {
13 | "include": ["jquery"]
14 | }
15 | }
16 | ```
17 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/typeRoots.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Type Roots"
3 | oneline: "Specify multiple folders that act like `./node_modules/@types`."
4 | ---
5 |
6 | By default all _visible_ "`@types`" packages are included in your compilation.
7 | Packages in `node_modules/@types` of any enclosing folder are considered _visible_.
8 | For example, that means packages within `./node_modules/@types/`, `../node_modules/@types/`, `../../node_modules/@types/`, and so on.
9 |
10 | If `typeRoots` is specified, _only_ packages under `typeRoots` will be included. For example:
11 |
12 | ```json tsconfig
13 | {
14 | "compilerOptions": {
15 | "typeRoots": ["./typings", "./vendor/types"]
16 | }
17 | }
18 | ```
19 |
20 | This config file will include _all_ packages under `./typings` and `./vendor/types`, and no packages from `./node_modules/@types`.
21 | All paths are relative to the `tsconfig.json`.
22 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/useDefineForClassFields.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Use Define For Class Fields"
3 | oneline: "Emit ECMAScript-standard-compliant class fields."
4 | ---
5 |
6 | This flag is used as part of migrating to the upcoming standard version of class fields. TypeScript introduced class fields many years before it was ratified in TC39. The latest version of the upcoming specification has a different runtime behavior to TypeScript's implementation but the same syntax.
7 |
8 | This flag switches to the upcoming ECMA runtime behavior.
9 |
10 | You can read more about the transition in [the 3.7 release notes](/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier).
11 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/useUnknownInCatchVariables.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Use Unknown In Catch Variables"
3 | oneline: "Default catch clause variables as `unknown` instead of `any`."
4 | ---
5 |
6 | In TypeScript 4.0, support was added to allow changing the type of the variable in a catch clause from `any` to `unknown`. Allowing for code like:
7 |
8 | ```ts twoslash
9 | // @useUnknownInCatchVariables
10 | try {
11 | // ...
12 | } catch (err: unknown) {
13 | // We have to verify err is an
14 | // error before using it as one.
15 | if (err instanceof Error) {
16 | console.log(err.message);
17 | }
18 | }
19 | ```
20 |
21 | This pattern ensures that error handling code becomes more comprehensive because you cannot guarantee that the object being thrown _is_ a Error subclass ahead of time. With the flag `useUnknownInCatchVariables` enabled, then you do not need the additional syntax (`: unknown`) nor a linter rule to try enforce this behavior.
22 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/verbose.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Verbose"
3 | oneline: "Enable verbose logging."
4 | ---
5 |
6 | Enable verbose logging
7 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/watchDirectory.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Watch Directory"
3 | oneline: "Specify how directories are watched on systems that lack recursive file-watching functionality."
4 | ---
5 |
6 | The strategy for how entire directory trees are watched under systems that lack recursive file-watching functionality.
7 |
8 | - `fixedPollingInterval`: Check every directory for changes several times a second at a fixed interval.
9 | - `dynamicPriorityPolling`: Use a dynamic queue where less-frequently modified directories will be checked less often.
10 | - `useFsEvents` (the default): Attempt to use the operating system/file system's native events for directory changes.
11 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/options/watchFile.md:
--------------------------------------------------------------------------------
1 | ---
2 | display: "Watch File"
3 | oneline: "Specify how the TypeScript watch mode works."
4 | ---
5 |
6 | The strategy for how individual files are watched.
7 |
8 | - `fixedPollingInterval`: Check every file for changes several times a second at a fixed interval.
9 | - `priorityPollingInterval`: Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.
10 | - `dynamicPriorityPolling`: Use a dynamic queue where less-frequently modified files will be checked less often.
11 | - `useFsEvents` (the default): Attempt to use the operating system/file system's native events for file changes.
12 | - `useFsEventsOnParentDirectory`: Attempt to use the operating system/file system's native events to listen for changes on a file's parent directory
13 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/sections/Top Level.md:
--------------------------------------------------------------------------------
1 | ### Root Fields
2 |
3 | Starting up are the root options in the TSConfig - these options relate to how your TypeScript or JavaScript project is set up.
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/sections/buildOptions.md:
--------------------------------------------------------------------------------
1 | ## Build Options
2 |
3 | Type Acquisition is only important for JavaScript projects. In TypeScript projects you need to include the types in your projects explicitly. However, for JavaScript projects, the TypeScript tooling will download types for your modules in the background and outside of your node_modules folder.
4 |
5 | You may not want this, in which case you can turn off type acquisition by having this `jsconfig.json` in the root of your project:
6 |
7 | ```json
8 | {
9 | "typeAcquisition": {
10 | "enable": false
11 | }
12 | }
13 | ```
14 |
15 | Common uses for this section of a `jsconfig.json` is to tell TypeScript to download additional definitions for your tooling experience:
16 |
17 | ```json
18 | {
19 | "typeAcquisition": {
20 | "include": ["jquery"]
21 | }
22 | }
23 | ```
24 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/sections/compilerOptions.md:
--------------------------------------------------------------------------------
1 | ### Compiler Options
2 |
3 | These options make up the bulk of TypeScript's configuration and it covers how the language should work.
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/sections/typeAcquisition.md:
--------------------------------------------------------------------------------
1 | ## Type Acquisition
2 |
3 | Type Acquisition is only important for JavaScript projects. In TypeScript projects you need to include the types in your projects explicitly. However, for JavaScript projects, the TypeScript tooling will download types for your modules in the background and outside of your node_modules folder.
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/copy/en/sections/watchOptions.md:
--------------------------------------------------------------------------------
1 | ## Watch Options
2 |
3 | You can configure the how TypeScript `--watch` works. This section is mainly for handling case where `fs.watch` and `fs.watchFile` have additional constraints like on Linux. You can read more at [Configuring Watch](/docs/handbook/configuring-watch.html).
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/data/.gitignore:
--------------------------------------------------------------------------------
1 | *.json
2 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/output/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitkeep
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/output/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/tsconfig-reference/output/.gitkeep
--------------------------------------------------------------------------------
/packages/tsconfig-reference/scripts/schema/exampleTsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "./result/schema.json",
3 | "compilerOptions": {}
4 | }
5 |
--------------------------------------------------------------------------------
/packages/tsconfig-reference/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "es2020",
4 | "moduleResolution": "node",
5 | "resolveJsonModule": true,
6 | "allowSyntheticDefaultImports": true,
7 | "target": "es2019"
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/typescript-vfs/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 | .DS_Store
3 | node_modules
4 | .rts2_cache_cjs
5 | .rts2_cache_esm
6 | .rts2_cache_umd
7 | .rts2_cache_system
8 | dist
9 |
--------------------------------------------------------------------------------
/packages/typescript-vfs/scripts/makeGlobals.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 |
3 | // Creates a web version of tsvfs which sets a global of 'tsvfs'.
4 |
5 | const fs = require("fs")
6 | const path = require("path")
7 |
8 | const esm = fs.readFileSync(path.join(__dirname, "..", "dist", "vfs.esm.js"), "utf8")
9 | const body = esm.replace("export {", "const tsvfs = {")
10 | const suffix = `
11 | const getGlobal = function () {
12 | if (typeof self !== 'undefined') { return self; }
13 | if (typeof window !== 'undefined') { return window; }
14 | if (typeof global !== 'undefined') { return global; }
15 | throw new Error('unable to locate global object');
16 | };
17 |
18 | const globals = getGlobal();
19 | globals.tsvfs = tsvfs;
20 | `
21 |
22 | fs.writeFileSync(path.join(__dirname, "..", "dist", "vfs.globals.js"), body + suffix, "utf8")
23 |
--------------------------------------------------------------------------------
/packages/typescript-vfs/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "include": ["src", "types", "test"],
3 | "exclude": ["test"],
4 |
5 | "compilerOptions": {
6 | "target": "ES2015",
7 | "module": "esnext",
8 | "lib": ["esnext"],
9 | "importHelpers": true,
10 | "declaration": true,
11 | "sourceMap": true,
12 | "rootDir": "./src",
13 | "strict": true,
14 | "noImplicitAny": true,
15 | "strictNullChecks": true,
16 | "strictFunctionTypes": true,
17 | "strictPropertyInitialization": true,
18 | "noImplicitThis": true,
19 | "alwaysStrict": true,
20 | "noUnusedLocals": false,
21 | "noUnusedParameters": true,
22 | "noImplicitReturns": true,
23 | "noFallthroughCasesInSwitch": true,
24 | "moduleResolution": "node",
25 | "baseUrl": "./src",
26 | "paths": {
27 | "*": ["src/*", "node_modules/*"]
28 | },
29 | "jsx": "react",
30 | "esModuleInterop": true
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "endOfLine": "lf",
3 | "semi": false,
4 | "singleQuote": false,
5 | "tabWidth": 2,
6 | "trailingComma": "es5",
7 | "arrowParens": "avoid"
8 | }
9 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/README.md:
--------------------------------------------------------------------------------
1 | ## TypeScript Website
2 |
3 | This a pretty traditional Gatsby site. You can start it up via:
4 |
5 | ```sh
6 | pnpm start
7 | ```
8 |
9 | Which starts up a dev server.
10 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/backstop_default_Index_0_document_0_phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/backstop_default_Index_0_document_0_phone.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/backstop_default_Index_0_document_1_tablet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/backstop_default_Index_0_document_1_tablet.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/backstop_default_Index_0_document_2_computer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/_tests/backstop_data/bitmaps_reference/backstop_default_Index_0_document_2_computer.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/lib/bootup/ingestion/languageFilter.ts:
--------------------------------------------------------------------------------
1 | export const isMultiLingual = !process.env.NO_TRANSLATIONS
2 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/lib/bootup/pathsOnSiteTracker.ts:
--------------------------------------------------------------------------------
1 | import { existsSync, mkdirSync, writeFileSync } from "fs"
2 | import { join } from "path"
3 |
4 | const paths = [] as string[]
5 | export const addPathToSite = (path: string) => paths.push(path)
6 |
7 | export const writeAllPathsToFixture = () => {
8 | const generated = join(__dirname, "..", "..", "src", "__generated__")
9 | if (!existsSync(generated)) {
10 | mkdirSync(generated)
11 | }
12 |
13 | const allPagesPath = join(generated, "allPages.ts")
14 | writeFileSync(
15 | allPagesPath,
16 | `
17 | // Generated during bootstapping via pathsOnSiteTracker.ts
18 |
19 | export const allFiles = [${paths
20 | .map(item => '"' + item.replace(/\\/g, "/") + '",')
21 | .join("\n")}]`
22 | )
23 | }
24 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/scripts/backstop/makeDarkMode.js:
--------------------------------------------------------------------------------
1 | module.exports = async (page, scenario) => {
2 | console.log("SWITCHING TO DARK for " + scenario.label)
3 |
4 | await page.emulateMediaFeatures([
5 | {
6 | name: "prefers-color-scheme",
7 | value: "dark",
8 | },
9 | ])
10 | // await wait()
11 | }
12 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/scripts/updateIndexTwoslashExamples.js:
--------------------------------------------------------------------------------
1 | // @ts-check
2 |
3 | const { join } = require(`path`)
4 | const { readdirSync, readFileSync, lstatSync, writeFileSync } = require("fs")
5 |
6 | // prettier-ignore
7 | const examplesPath = join(__dirname,"..", "src", "components", "index", "generated")
8 |
9 | // Loop through all code sames in src/components/index/twoslash and generate HTML
10 | const go = async () => {
11 | console.log("Parsing index examples ->")
12 | for (const path of readdirSync(examplesPath, "utf-8")) {
13 | const filePath = join(examplesPath, path)
14 | if (lstatSync(filePath).isDirectory()) {
15 | continue
16 | }
17 |
18 | writeFileSync(
19 | filePath,
20 | readFileSync(filePath, "utf8").replace("267F99", "227289")
21 | )
22 | }
23 | }
24 |
25 | go()
26 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/conferences/tsconf-2019-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/conferences/tsconf-2019-logo.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/conferences/tsconf-eu-2020-brief.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/conferences/tsconf-eu-2020-brief.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/conferences/tsconf-eu-2020-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/conferences/tsconf-eu-2020-logo.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/conferences/tsconf-it-2019-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/conferences/tsconf-it-2019-logo.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/conferences/tsconf-jp-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/conferences/tsconf-jp-logo.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-blog-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-github-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/connect-github-icon.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-gitter.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-group-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-stackoverflow-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-twitter-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/connect-uservoice-icon.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/definitely_typed_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/definitely_typed_logo.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/boston-ts-club.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/boston-ts-club.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/brazil-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/brazil-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/dublin-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/dublin-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/hamburg-ts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/hamburg-ts.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/ktug.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/ktug.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/london-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/london-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/melbourne.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/melbourne.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/milano-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/milano-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/paris-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/paris-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/phx-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/phx-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/san-fran-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/san-fran-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/seattle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/seattle.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/sqvts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/sqvts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/sydney.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/sydney.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/typescript-jp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/typescript-jp.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/typescript-nyc.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/typescript-nyc.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/warsaw-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/warsaw-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/community/meetup-logos/wroclaw-ts.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/community/meetup-logos/wroclaw-ts.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/index/code-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/index/code-dark.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/index/code-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/index/code-light.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/index/handbook.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/index/handbook.jpg
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/index/play-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/index/play-dark.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/index/play-light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/index/play-light.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/microsoft-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/microsoft-logo.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/playground-plugin-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/playground-plugin-preview.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/typescript-handbook.epub/index.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/typescript-handbook.pdf/index.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/assets/v3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/TypeScript-Website/b0e9a5c007b3e953d409f989f6013078bdd363ed/packages/typescriptlang-org/src/assets/v3.png
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/components/Intl.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { IntlProvider } from 'react-intl';
3 |
4 | type IntlProps = {
5 | locale: string
6 | children: any
7 | }
8 |
9 | export const Intl = (props: IntlProps) => {
10 | const { children, locale } = props
11 | let messages = require("../copy/en/en").lang
12 | try {
13 | messages = require("../copy/" + locale + "/" + locale).lang
14 | } catch (error) {
15 | // NOOP
16 | }
17 | return (
18 |
19 | {children}
20 |
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/components/TmpLink.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 |
3 | import { GatsbyLinkProps } from "gatsby";
4 |
5 | export const Link = (props: GatsbyLinkProps<{}>) => {
6 | return
7 | }
8 |
--------------------------------------------------------------------------------
/packages/typescriptlang-org/src/components/display/ButtonGrid.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react"
2 | import { GreyButton } from "./GreyButton"
3 |
4 | type ButtonProps = Omit
5 | export type GridProps = {
6 | buttons: ButtonProps[]
7 | headline?: true
8 | }
9 |
10 |
11 | /** A pretty grid of grey buttons */
12 | export const ButtonGrid = (props: GridProps) => (
13 |