Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the documentation on how to setup Typescript types with Next.js #76

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,24 @@ import img from "./img.png";

### Typescript
Typescript doesn't know how interpret imported images. `next-images` package contains definitions for image modules,
**you need to add reference to next-images types** (third line) into your `next-env.d.ts` file.
**you need to add reference to next-images types** into a type definition file, e.g. `additional.d.ts`, and then reference this from `tsconfig.json`.

```diff
/// <reference types="next" />
/// <reference types="next/types/global" />
```js
// additional.d.ts
/// <reference types="next-images" />
```

+ /// <reference types="next-images" />
```json
// tsconfig.json
{
...
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "additional.d.ts"],
...
}
```

See the Next.js [docs](https://nextjs.org/docs/basic-features/typescript) for more information.

### With `next/image`

Base4/Data URL encoding is not supported when using the `next/image` component for image optimization. To deactivate inline images you can set the `inlineImageLimit` to `false`:
Expand Down