Skip to content

Commit

Permalink
chore(deps): typescript 4.9 (#11229)
Browse files Browse the repository at this point in the history
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
  • Loading branch information
patak-dev and bluwy authored Dec 7, 2022
1 parent d135b11 commit 6b4c4e2
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 53 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"simple-git-hooks": "^2.8.1",
"tslib": "^2.4.1",
"tsx": "^3.12.1",
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"unbuild": "^0.9.4",
"vite": "workspace:*",
"vitepress": "^1.0.0-alpha.29",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-vite/template-lit-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"lit": "^2.4.1"
},
"devDependencies": {
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"vite": "^3.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-preact-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@preact/preset-vite": "^2.4.0",
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"vite": "^3.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^3.0.0-alpha.2",
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"vite": "^3.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"svelte-check": "^2.10.0",
"svelte-preprocess": "^4.10.7",
"tslib": "^2.4.1",
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"vite": "^3.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"devDependencies": {
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"vite": "^3.2.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vue-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.0.0-alpha.2",
"typescript": "^4.6.4",
"typescript": "^4.9.3",
"vite": "^3.2.4",
"vue-tsc": "^1.0.11"
}
Expand Down
4 changes: 0 additions & 4 deletions packages/vite/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,9 @@ export function updateStyle(id: string, content: string): void {

if (!style) {
style = new CSSStyleSheet()
// @ts-expect-error: using experimental API
style.replaceSync(content)
// @ts-expect-error: using experimental API
document.adoptedStyleSheets = [...document.adoptedStyleSheets, style]
} else {
// @ts-expect-error: using experimental API
style.replaceSync(content)
}
} else {
Expand All @@ -389,7 +386,6 @@ export function removeStyle(id: string): void {
const style = sheetsMap.get(id)
if (style) {
if (style instanceof CSSStyleSheet) {
// @ts-expect-error: using experimental API
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(
(s: CSSStyleSheet) => s !== style,
)
Expand Down
1 change: 0 additions & 1 deletion packages/vite/src/node/__tests__/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ describe('resolveBuildOutputs', () => {
})

test('array outputs: should ignore build.lib.formats', () => {
// @ts-expect-error mock Logger
const log = { warn: vi.fn() } as Logger
expect(
resolveBuildOutputs(
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ const less: StylePreprocessor = async (source, root, options, resolvers) => {
// normalize error info
const normalizedError: RollupError = new Error(
`[less] ${error.message || error.type}`,
)
) as RollupError
normalizedError.loc = {
file: error.filename || options.filename,
line: error.line,
Expand Down
5 changes: 3 additions & 2 deletions packages/vite/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ export function createPluginHookUtils(
return plugins
.map((p) => {
const hook = p[hookName]!
// @ts-expect-error cast
return 'handler' in hook ? hook.handler : hook
return typeof hook === 'object' && 'handler' in hook
? hook.handler
: hook
})
.filter(Boolean)
}
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export async function createPluginContainer(
for (const plugin of getSortedPlugins(hookName)) {
const hook = plugin[hookName]
if (!hook) continue
// @ts-expect-error
const handler: Function = 'handler' in hook ? hook.handler : hook
if ((hook as { sequential?: boolean }).sequential) {
await Promise.all(parallelPromises)
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ function splitSrcSetDescriptor(srcs: string): ImageCandidate[] {
return splitSrcSet(srcs)
.map((s) => {
const src = s.replace(escapedSpaceCharacters, ' ').trim()
const [url] = imageSetUrlRE.exec(src) || []
const [url] = imageSetUrlRE.exec(src) || ['']

return {
url,
Expand Down Expand Up @@ -884,6 +884,7 @@ export async function resolveServerUrls(
// Node < v18
((typeof detail.family === 'string' && detail.family === 'IPv4') ||
// Node >= v18
// @ts-expect-error
(typeof detail.family === 'number' && detail.family === 4)),
)
.forEach((detail) => {
Expand Down
Loading

0 comments on commit 6b4c4e2

Please sign in to comment.