Skip to content

Instantly share code, notes, and snippets.

@petekp
Created March 14, 2019 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petekp/170b1fa4837f5f3e77ad077a5cd3c752 to your computer and use it in GitHub Desktop.
Save petekp/170b1fa4837f5f3e77ad077a5cd3c752 to your computer and use it in GitHub Desktop.
tsconfig.json for npm react component lib
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"baseUrl": "src",
"declaration": true,
"jsx": "react",
"module": "commonjs",
"moduleResolution": "node",
"noUnusedLocals": true,
"outDir": "dist",
"sourceMap": true,
"strict": true,
"target": "esnext",
}
}
@petekp
Copy link
Author

petekp commented Mar 14, 2019

To generate types for your components, you'll want to create a new npm script (e.g. build:types) that runs the typescript compiler with these flags: tsc --declaration --emitDeclarationOnly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment