Skip to content

Commit

Permalink
Move styled-jsx type reference (#37964)
Browse files Browse the repository at this point in the history
Follow-up to #37902 this moves the reference to avoid a change in `next-env.d.ts`. Also updates our doc note on the `next-env.d.ts` file to be more explicit about it being ignored.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
  • Loading branch information
ijjk committed Jun 23, 2022
1 parent 7c484a8 commit 7bb247c
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/basic-features/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ npm run dev

You're now ready to start converting files from `.js` to `.tsx` and leveraging the benefits of TypeScript!

> A file named `next-env.d.ts` will be created in the root of your project. This file ensures Next.js types are picked up by the TypeScript compiler. **You cannot remove it or edit it** as it can change at any time.
> A file named `next-env.d.ts` will be created in the root of your project. This file ensures Next.js types are picked up by the TypeScript compiler. **You cannot remove it or edit it** as it can change at any time. As such this file should not be committed and should be ignored by version control.
> TypeScript `strict` mode is turned off by default. When you feel comfortable with TypeScript, it's recommended to turn it on in your `tsconfig.json`.
Expand Down
1 change: 1 addition & 0 deletions packages/next/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
/// <reference path="./router.d.ts" />
/// <reference path="./script.d.ts" />
/// <reference path="./server.d.ts" />
/// <reference path="./dist/styled-jsx-types/global" />

export { default } from './types'
export * from './types'
2 changes: 0 additions & 2 deletions packages/next/lib/typescript/writeAppTypeDeclarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export async function writeAppTypeDeclarations(
const content =
'/// <reference types="next" />' +
eol +
'/// <reference types="next/dist/styled-jsx-types/global" />' +
eol +
(imageImportsEnabled
? '/// <reference types="next/image-types/global" />' + eol
: '') +
Expand Down
6 changes: 0 additions & 6 deletions test/unit/write-app-declarations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ describe('find config', () => {
const content =
'/// <reference types="next" />' +
eol +
'/// <reference types="next/dist/styled-jsx-types/global" />' +
eol +
(imageImportsEnabled
? '/// <reference types="next/image-types/global" />' + eol
: '') +
Expand All @@ -39,8 +37,6 @@ describe('find config', () => {
const content =
'/// <reference types="next" />' +
eol +
'/// <reference types="next/dist/styled-jsx-types/global" />' +
eol +
(imageImportsEnabled
? '/// <reference types="next/image-types/global" />' + eol
: '') +
Expand All @@ -62,8 +58,6 @@ describe('find config', () => {
const content =
'/// <reference types="next" />' +
eol +
'/// <reference types="next/dist/styled-jsx-types/global" />' +
eol +
(imageImportsEnabled
? '/// <reference types="next/image-types/global" />' + eol
: '') +
Expand Down

0 comments on commit 7bb247c

Please sign in to comment.