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

docs: override vite/client type #9488

Merged
merged 3 commits into from
Aug 2, 2022
Merged
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ This will provide the following type shims:
- Types for the Vite-injected [env variables](./env-and-mode#env-variables) on `import.meta.env`
- Types for the [HMR API](./api-hmr) on `import.meta.hot`

::: tip
To override the default typing, declare it before the triple-slash reference.
For example, to make a default import of `*.svg` a React component, it will be like:
bluwy marked this conversation as resolved.
Show resolved Hide resolved

```ts
declare module '*.svg' {
const content: React.FC<React.SVGProps<SVGElement>>
export default content
}

/// <reference types="vite/client" />
```

:::

## Vue

Vite provides first-class Vue support:
Expand Down