Getting started
Take over typescript-config in a new or an existing repository, extend a preset, and run the first type-check.
@workspace/typescript-config 1.0.0Developmentunreleased, maintained in Foundation as a copy
These steps were carried out in a new, empty pnpm workspace outside every source repository, with a copy of the package folder and nothing else: no path to Foundation and no other source.
A new repository#
Copy the package#
Take the folder
packages/typescript-configfrom Foundation as a whole, withoutnode_modules, and place it unchanged atpackages/typescript-configin your repository. Keep its bytes exact:Text# .gitattributespackages/** -textThen check that your copy equals the source, file by file:
Terminaldiff -rq -x node_modules -x .turbo <foundation>/packages/typescript-config packages/typescript-configNo output means equal. Record where the copy came from (see Development basis).
Declare and install#
Declare the package once, at the root, and install TypeScript in each package or app that type-checks, with the type packages its preset needs:
JSON{ "devDependencies": { "@workspace/typescript-config": "workspace:*" }}JSON{ "devDependencies": { "@types/node": "^26", "typescript": "^6.0.3" }}Preset Your package or app also needs nodejs.json @types/node react-library. json @types/(andreact react), for JSXnextjs.json next,react,@types/, and Next'sreact next-env. d. ts Terminalpnpm installType-check#
JSON{ "scripts": { "typecheck": "tsc --noEmit" }}Terminalpnpm --filter <package> typechecktscexits with 0 and no output when the types are correct, and with 2 and a list of errors when they are not. Unlike lint, there is no threshold: one type error fails the run.
An existing repository#
| Your repository | What to do |
|---|---|
has no packages/ | the steps above |
has a copy at packages/ from another source | compare it with diff -rq, then replace the whole folder by Foundation's copy, never single files, and update your record of where it came from |
has its own tsconfig settings, without this package | extend a preset and remove every setting the preset already carries; keep only include, exclude, output, paths, types and plugins (Extending) |
After switching, run the type-check of every package and app. The shared base is strict:
noUncheckedIndexedAccess in particular reports index access that a looser configuration
accepted. Those errors are work of your repository; they are not solved by relaxing the option.
Updating#
There is no transfer tooling for this package. When Foundation has a new state, replace the whole
folder in one go, compare it with diff -rq, read the
changelog, and run your type-checks. Your copy is never
edited in place: a change you need is made in Foundation and reaches you with the next copy.