question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add sample `tsconfig.json` to docs for adding TypeScript to existing project

See original GitHub issue

It would be useful if the documentation for adding TypeScript included a sample tsconfig.json for people who are upgrading existing projects. Currently the documentation states that one will be generated for you, but that only applies if you are initializing a new project.

In the meantime, for those who run into this issue, I created a dummy project and ran the initialization to get this config:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve"
  },
  "include": [
    "src"
  ]
}

If this is the correct “default” config, then this can be added to or linked to the existing documentation page about TypeScript to make it easier for existing projects to convert.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
johndturncommented, Jan 17, 2019

I’ve just converted an existing, non-ejected CRA-based project from JavaScript to TypeScript, and I can confirm that the tsconfig.json file was generated for me.

For reference, I’m on react-scripts: 2.1.3

1reaction
Timercommented, Jan 17, 2019

We have changed the template a few times. The template created when you create a project or change an existing project is identical (the new project actually calls the exact code).

If at any time you want to regenerate the file, you can just delete your tsconfig.json and re-run npm start.

Maybe we can note that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - What is a tsconfig.json - TypeScript
The tsconfig.json file specifies the root files and the compiler options required to compile the project. JavaScript projects can use a jsconfig.json file ......
Read more >
Setting up TypeScript project with tsconfig.json - LogicBig
This tutorial shows how to build a TypeScript project with the help of tsconfig.json. The file tsconfig.json is TypeScript specific and its ...
Read more >
How to Set Up a Node.js Project with TypeScript
Learn how to add TypeScript support to Node.js projects. ... This file is called tsconfig.json , and you should place it at the...
Read more >
TypeScript tutorial with Visual Studio Code
Let's start with a simple Hello World Node.js example. Create a new folder HelloWorld and launch VS Code. mkdir HelloWorld cd HelloWorld ...
Read more >
Adding Typescript to your Existing Rails App - Honeybadger.io
The command above adds the TypeScript compiler to your project, which can be accessed using the npx tsc command. You can also install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found