2024-02-15 03:47:25 +00:00
|
|
|
{
|
|
|
|
/* Docs: https://aka.ms/tsconfig.json */
|
|
|
|
"compilerOptions": {
|
2024-02-16 04:12:44 +00:00
|
|
|
/* We use TypeScript (tsc) as a type checker, not as a build tool */
|
2024-02-15 03:47:25 +00:00
|
|
|
"noEmit": true,
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tell TypeScript which all things it can assume that our target
|
|
|
|
* runtime will have.
|
|
|
|
*
|
|
|
|
* In our case, we tell it that the code will run in a modern browser,
|
|
|
|
* and will have access to a latest JS (esnext) and the DOM (dom). Our
|
2024-02-15 06:35:56 +00:00
|
|
|
* transpiler (Next.js) will ensure that these things hold.
|
2024-02-15 03:47:25 +00:00
|
|
|
*
|
|
|
|
* Unlike the other individual library components (say how "esnext"
|
|
|
|
* implies "esnext.*"), "dom.iterable" (the ability to iterate over DOM
|
|
|
|
* elements) is not a subset of "dom" and needs to be listed out
|
|
|
|
* explicitly.
|
|
|
|
*
|
2024-02-15 06:35:56 +00:00
|
|
|
* Note that we don't need to specify the `target` compilerOption, since
|
2024-02-16 04:12:44 +00:00
|
|
|
* tsc isn't actually generating (emitting) the JavaScript.
|
2024-02-15 03:47:25 +00:00
|
|
|
*/
|
|
|
|
"lib": ["esnext", "dom", "dom.iterable"],
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The module system to assume the generated JavaScript will use.
|
|
|
|
*
|
2024-02-16 04:12:44 +00:00
|
|
|
* Since we're using a bundler, we should set this to "esnext"
|
2024-02-15 03:47:25 +00:00
|
|
|
* https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html
|
|
|
|
*/
|
|
|
|
"module": "esnext",
|
2024-02-16 04:12:44 +00:00
|
|
|
|
2024-02-15 03:47:25 +00:00
|
|
|
/*
|
|
|
|
* Tell TypeScript how to lookup the file for a given import
|
|
|
|
*
|
|
|
|
* From the TypeScript docs:
|
|
|
|
*
|
|
|
|
* > 'bundler' is for use with bundlers. Like node16 and nodenext, this
|
|
|
|
* mode supports package.json `imports` and `exports`, but unlinke the
|
|
|
|
* Node.js resolution modes, bundler never requires file extensions on
|
|
|
|
* relative paths in imports.
|
|
|
|
*
|
|
|
|
* > bundler does not support resolution of `require` calls.
|
|
|
|
*/
|
|
|
|
"moduleResolution": "bundler",
|
|
|
|
|
2024-02-16 04:12:44 +00:00
|
|
|
/* Allow use of `.tsx` files, but don't tranform them */
|
2024-02-15 03:47:25 +00:00
|
|
|
"jsx": "preserve",
|
|
|
|
|
|
|
|
/* Ask TypeScript to warn us if we use TypeScript features that cannot
|
2024-02-15 06:35:56 +00:00
|
|
|
be used by single-file transpilers */
|
2024-02-15 03:47:25 +00:00
|
|
|
"isolatedModules": true,
|
|
|
|
/* Enable various workarounds to play better with CJS libraries */
|
|
|
|
"esModuleInterop": true,
|
|
|
|
|
|
|
|
/* Speed things up by not type checking `node_modules` */
|
|
|
|
"skipLibCheck": true,
|
|
|
|
/* Require the `type` modifier when importing types */
|
|
|
|
"verbatimModuleSyntax": true,
|
|
|
|
/* Enable importing .json files */
|
|
|
|
"resolveJsonModule": true,
|
|
|
|
|
|
|
|
"strict": true,
|
|
|
|
/* Stricter than strict */
|
|
|
|
"noImplicitReturns": true,
|
|
|
|
"noUnusedParameters": true,
|
|
|
|
"noUnusedLocals": true,
|
|
|
|
"noFallthroughCasesInSwitch": true,
|
|
|
|
/* e.g. makes array indexing returns undefined */
|
|
|
|
"noUncheckedIndexedAccess": true,
|
|
|
|
"exactOptionalPropertyTypes": true
|
|
|
|
},
|
|
|
|
/*
|
|
|
|
* Typecheck all files (here or in subfolders) with the given extensions
|
|
|
|
*/
|
|
|
|
"include": ["**/*.ts", "**/*.tsx"]
|
|
|
|
}
|