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

feat(create-app): improve client types #3214

Merged
merged 4 commits into from
May 22, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ Vite's default types are for its Node.js API. To shim the environment of client
}
```

Also, you can add a `d.ts` declaration file:
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved

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

This will provide the following type shims:

- Asset imports (e.g. importing an `.svg` file)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-lit-element-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"module": "esnext",
"lib": ["es2017", "dom", "dom.iterable"],
"types": ["vite/client"],
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./types",
Expand Down
1 change: 1 addition & 0 deletions packages/create-app/template-preact-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-preact-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
Expand Down
1 change: 1 addition & 0 deletions packages/create-app/template-react-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-react-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
Expand Down
1 change: 1 addition & 0 deletions packages/create-app/template-vanilla-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-vanilla-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"types": ["vite/client"],
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
Expand Down
1 change: 1 addition & 0 deletions packages/create-app/template-vue-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
3 changes: 1 addition & 2 deletions packages/create-app/template-vue-ts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["vite/client"]
"lib": ["esnext", "dom"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}