Skip to content

Commit

Permalink
chore(docs): add section for Custom Type Declarations (#60282)
Browse files Browse the repository at this point in the history
We used to have docs but it was lost in the rewrite (as seen in this
comment
#30060 (comment))

This PR adds back the documentation for Custom Type Declarations.

Closes NEXT-1999
  • Loading branch information
styfle committed Jan 5, 2024
1 parent f76ed00 commit d946c66
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,27 @@ module.exports = {
}
```

## Custom Type Declarations

When you need to declare custom types, you might be tempted to modify `next-env.d.ts`. However, this file is automatically generated, so any changes you make will be overwritten. Instead, you should create a new file, let's call it `new-types.d.ts`, and reference it in your `tsconfig.json`:

```json filename="tsconfig.json"
{
"compilerOptions": {
"skipLibCheck": true
//...truncated...
},
"include": [
"new-types.d.ts",
"next-env.d.ts",
".next/types/**/*.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": ["node_modules"]
}
```

## Version Changes

| Version | Changes |
Expand Down

0 comments on commit d946c66

Please sign in to comment.