Skip to content

Commit

Permalink
Update README.md with tsconfig.json
Browse files Browse the repository at this point in the history
  • Loading branch information
fabien0102 committed Apr 24, 2017
1 parent 53a8c41 commit ae9434e
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions packages/gatsby-plugin-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@
Provides drop-in support for TypeScript and TSX.

## Install
`yarn add gatsby-plugin-typescript ts-loader typescript`
`yarn add gatsby-plugin-typescript typescript`

## How to use
1. Include the plugin in your `gatsby-config.js` file.
2. Write your components in TSX or TypeScript.
3. You're good to go.
1. Add `tsconfig.json` file on your root directory.
1. Write your components in TSX or TypeScript.
1. You're good to go.

`gatsby-config.js`
```javascript
// in gatsby-config.js
plugins: [
// no configuration
`gatsby-plugin-typescript`,
// custom configuration
{
resolve: `gatsby-plugin-typescript`,
options: {
// compilerOptions are passed directly to the compiler
compilerOptions: {
target: `esnext`,
experimentalDecorators: true,
jsx: `react`
}
}
}
]
```

`tsconfig.json`
```json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "esnext",
"jsx": "react",
"lib": ["dom", "es2015", "es2017"]
},
"include": [
"./src/**/*"
]
}
```

0 comments on commit ae9434e

Please sign in to comment.