Skip to content

Commit 58e5c51

Browse files
committed
build: upgrade to TypeScript 5.x
1 parent e60ebd0 commit 58e5c51

File tree

8 files changed

+101
-63
lines changed

8 files changed

+101
-63
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@rollup/plugin-terser": "^0.1.0",
6767
"@types/hash-sum": "^1.0.0",
6868
"@types/node": "^16.4.7",
69-
"@typescript-eslint/parser": "^5.23.0",
69+
"@typescript-eslint/parser": "^5.56.0",
7070
"@vitest/coverage-istanbul": "^0.29.7",
7171
"@vue/consolidate": "0.17.3",
7272
"brotli": "^1.3.2",
@@ -90,7 +90,7 @@
9090
"pug": "^3.0.1",
9191
"puppeteer": "^19.6.3",
9292
"rollup": "^3.20.0",
93-
"rollup-plugin-dts": "^5.1.1",
93+
"rollup-plugin-dts": "^5.3.0",
9494
"rollup-plugin-esbuild": "^5.0.0",
9595
"rollup-plugin-node-builtins": "^2.1.2",
9696
"rollup-plugin-node-globals": "^1.4.0",
@@ -100,8 +100,8 @@
100100
"simple-git-hooks": "^2.8.1",
101101
"terser": "^5.15.1",
102102
"todomvc-app-css": "^2.3.0",
103-
"tslib": "^2.4.0",
104-
"typescript": "^4.9.0",
103+
"tslib": "^2.5.0",
104+
"typescript": "^5.0.0",
105105
"vite": "^4.2.0",
106106
"vitest": "^0.29.7"
107107
}

packages/compiler-core/src/transforms/transformElement.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,14 @@ export const transformElement: NodeTransform = (node, context) => {
210210
if (__DEV__) {
211211
if (patchFlag < 0) {
212212
// special flags (negative and mutually exclusive)
213-
vnodePatchFlag = patchFlag + ` /* ${PatchFlagNames[patchFlag]} */`
213+
vnodePatchFlag =
214+
patchFlag + ` /* ${PatchFlagNames[patchFlag as PatchFlags]} */`
214215
} else {
215216
// bitwise flags
216217
const flagNames = Object.keys(PatchFlagNames)
217218
.map(Number)
218219
.filter(n => n > 0 && patchFlag & n)
219-
.map(n => PatchFlagNames[n])
220+
.map(n => PatchFlagNames[n as PatchFlags])
220221
.join(`, `)
221222
vnodePatchFlag = patchFlag + ` /* ${flagNames} */`
222223
}

packages/dts-test/defineComponent.test-d.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ describe('with mixins', () => {
563563
expectType<string>(props.z)
564564
// props
565565
expectType<((...args: any[]) => any) | undefined>(props.onClick)
566-
// from Base
566+
// from MixinA
567567
expectType<((...args: any[]) => any) | undefined>(props.onBar)
568568
expectType<string>(props.aP1)
569569
expectType<boolean | undefined>(props.aP2)
@@ -575,7 +575,7 @@ describe('with mixins', () => {
575575
const props = this.$props
576576
// props
577577
expectType<((...args: any[]) => any) | undefined>(props.onClick)
578-
// from Base
578+
// from MixinA
579579
expectType<((...args: any[]) => any) | undefined>(props.onBar)
580580
expectType<string>(props.aP1)
581581
expectType<boolean | undefined>(props.aP2)

packages/runtime-core/src/componentOptions.ts

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import {
1515
isArray,
1616
NOOP,
1717
isPromise,
18-
LooseRequired,
19-
UnionToIntersection
18+
LooseRequired
2019
} from '@vue/shared'
2120
import { isRef, Ref } from '@vue/reactivity'
2221
import { computed } from './apiComputed'
@@ -58,7 +57,9 @@ import { Directive } from './directives'
5857
import {
5958
CreateComponentPublicInstance,
6059
ComponentPublicInstance,
61-
isReservedPrefix
60+
isReservedPrefix,
61+
IntersectionMixin,
62+
UnwrapMixinsType
6263
} from './componentPublicInstance'
6364
import { warn } from './warning'
6465
import { VNodeChild } from './vnode'
@@ -93,21 +94,6 @@ export interface ComponentCustomOptions {}
9394

9495
export type RenderFunction = () => VNodeChild
9596

96-
type ExtractOptionProp<T> = T extends ComponentOptionsBase<
97-
infer P, // Props
98-
any, // RawBindings
99-
any, // D
100-
any, // C
101-
any, // M
102-
any, // Mixin
103-
any, // Extends
104-
any // EmitsOptions
105-
>
106-
? unknown extends P
107-
? {}
108-
: P
109-
: {}
110-
11197
export interface ComponentOptionsBase<
11298
Props,
11399
RawBindings,
@@ -129,8 +115,10 @@ export interface ComponentOptionsBase<
129115
props: Readonly<
130116
LooseRequired<
131117
Props &
132-
UnionToIntersection<ExtractOptionProp<Mixin>> &
133-
UnionToIntersection<ExtractOptionProp<Extends>>
118+
UnwrapMixinsType<
119+
IntersectionMixin<Mixin> & IntersectionMixin<Extends>,
120+
'P'
121+
>
134122
>
135123
>,
136124
ctx: SetupContext<E>

packages/runtime-core/src/componentPublicInstance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ type ExtractMixin<T> = {
100100
Mixin: MixinToOptionTypes<T>
101101
}[T extends ComponentOptionsMixin ? 'Mixin' : never]
102102

103-
type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true
103+
export type IntersectionMixin<T> = IsDefaultMixinComponent<T> extends true
104104
? OptionTypesType<{}, {}, {}, {}, {}>
105105
: UnionToIntersection<ExtractMixin<T>>
106106

107-
type UnwrapMixinsType<
107+
export type UnwrapMixinsType<
108108
T,
109109
Type extends OptionTypesKeys
110110
> = T extends OptionTypesType ? T[Type] : never

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export function defineCustomElement(
137137
options: any,
138138
hydrate?: RootHydrateFunction
139139
): VueElementConstructor {
140-
const Comp = defineComponent(options as any)
140+
const Comp = defineComponent(options) as any
141141
class VueCustomElement extends VueElement {
142142
static def = Comp
143143
constructor(initialProps?: Record<string, any>) {

packages/shared/src/patchFlags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const enum PatchFlags {
125125
/**
126126
* dev only flag -> name mapping
127127
*/
128-
export const PatchFlagNames = {
128+
export const PatchFlagNames: Record<PatchFlags, string> = {
129129
[PatchFlags.TEXT]: `TEXT`,
130130
[PatchFlags.CLASS]: `CLASS`,
131131
[PatchFlags.STYLE]: `STYLE`,

0 commit comments

Comments
 (0)