]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: adjust test
authordaiwei <daiwei521@126.com>
Fri, 14 Feb 2025 09:48:41 +0000 (17:48 +0800)
committerdaiwei <daiwei521@126.com>
Fri, 14 Feb 2025 09:48:41 +0000 (17:48 +0800)
packages/compiler-sfc/__tests__/compileScript/resolveType.spec.ts
packages/compiler-sfc/src/script/resolveType.ts

index cf96d5858fb5841cffc6434c05bace2e3e7afe67..7716763b8b1dc7947fffc0903484b62f4ec0b122 100644 (file)
@@ -790,17 +790,6 @@ describe('resolveType', () => {
       })
     })
 
-    test('generic type /w intersection', () => {
-      expect(
-        resolve(`
-        type Wrapped<T> = T & symbol & number
-        defineProps<{foo?: Wrapped<boolean>}>()
-      `).props,
-      ).toStrictEqual({
-        foo: ['Boolean', 'Symbol', 'Number'],
-      })
-    })
-
     test('generic from external-file', () => {
       const files = {
         '/foo.ts': 'export type P<T> = { foo: T }',
index 38726896b99d2c955c7da9cc3faa23e907b8b18a..0e9920e99ac7c790cc5d611ceda850f613fa46da 100644 (file)
@@ -1466,7 +1466,7 @@ export function inferRuntimeType(
   node: Node & MaybeWithScope,
   scope: TypeScope = node._ownerScope || ctxToScope(ctx),
   isKeyOf = false,
-  typeParameters: Record<string, Node> | undefined = undefined,
+  typeParameters?: Record<string, Node>,
 ): string[] {
   try {
     switch (node.type) {
@@ -1563,7 +1563,7 @@ export function inferRuntimeType(
               isKeyOf,
             )
           } else if (resolved.type === 'TSTypeAliasDeclaration') {
-            const typeParams = Object.create(null)
+            const typeParams: Record<string, Node> = Object.create(null)
             if (resolved.typeParameters) {
               resolved.typeParameters.params.forEach((p, i) => {
                 typeParams![p.name] = node.typeParameters!.params[i]
@@ -1722,13 +1722,9 @@ export function inferRuntimeType(
       case 'TSUnionType':
         return flattenTypes(ctx, node.types, scope, isKeyOf, typeParameters)
       case 'TSIntersectionType': {
-        return flattenTypes(
-          ctx,
-          node.types,
-          scope,
-          isKeyOf,
-          typeParameters,
-        ).filter(t => t !== UNKNOWN_TYPE)
+        return flattenTypes(ctx, node.types, scope, isKeyOf).filter(
+          t => t !== UNKNOWN_TYPE,
+        )
       }
 
       case 'TSEnumDeclaration':