Many blog posts and the example on Gatsby JS's website demonstrate the use of a tsconfig.json
file alongside the gatsby-plugin-typescript for TypeScript support in Gatsby. However, it seems like the tsconfig.json
file is not actually utilized for configuration purposes. This raises the question of whether my assumption is correct.
Gatsby utilizes
@babel/plugin-transform-typescript
to convert TypeScript to JavaScript, with detailed documentation available regarding how this Babel plugin mirrors the options of the tsc
TypeScript compiler. According to the docs:
Changes made to your tsconfig.json file do not impact Babel. The build process continues to operate as if isolatedModules is enabled, although there are Babel-native alternatives for setting many of the options typically found in tsconfig.json.
Is there a specific reason why all TypeScript setups for Gatsby include a tsconfig.json
file and configuration, despite it seemingly being unused by Gatsby itself?