From 372edd4ac4fa125bc9fd42dab74b3bc99aa35ac7 Mon Sep 17 00:00:00 2001 From: Blake Newman Date: 2022年9月20日 10:10:29 +0100 Subject: [PATCH] fix(types): deny unknown attributes by default Deny unknown attributes by default; using type for `ReservedProps` gave a default index signature which allowed uknown attributes. Import expectType in tsx type test as this was causing false error suppression. --- types/jsx.d.ts | 2 +- types/test/v3/tsx-test.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/jsx.d.ts b/types/jsx.d.ts index 4924f4c643c..6ed0e179a21 100644 --- a/types/jsx.d.ts +++ b/types/jsx.d.ts @@ -1300,7 +1300,7 @@ type EventHandlers = { [K in keyof E]?: E[K] extends Function ? E[K] : (payload: E[K]) => void } -type ReservedProps = { +interface ReservedProps { key?: string | number | symbol ref?: VNodeData['ref'] /** diff --git a/types/test/v3/tsx-test.tsx b/types/test/v3/tsx-test.tsx index 286c16997a0..18087d838b2 100644 --- a/types/test/v3/tsx-test.tsx +++ b/types/test/v3/tsx-test.tsx @@ -1,5 +1,5 @@ import { VNode, defineComponent, ref } from '../../index' -import { expectType } from '../utils' +import { expectType, expectError } from '../utils' expectType(
) expectType(
) @@ -47,7 +47,7 @@ const Foo = defineComponent({ }) // @ts-expect-error -; +; // @ts-expect-error ; // @ts-expect-error

AltStyle によって変換されたページ (->オリジナル) /