@@ -98,6 +98,13 @@ import type { RendererElement } from './renderer'
9898
9999export type Data = Record < string , unknown >
100100
101+ /**
102+ * For extending allowed non-declared attrs on components in TSX
103+ */
104+ export interface AllowedAttrs { }
105+
106+ export type Attrs = Data & AllowedAttrs
107+
101108/**
102109 * Public utility type for extracting the instance type of a component.
103110 * Works with all valid component definition types. This is intended to replace
@@ -283,7 +290,7 @@ export type SetupContext<
283290 S extends SlotsType = { } ,
284291> = E extends any
285292 ? {
286- attrs : Data
293+ attrs : Attrs
287294 slots : UnwrapSlotsType < S >
288295 emit : EmitFn < E >
289296 expose : < Exposed extends Record < string , any > = Record < string , any > > (
@@ -1152,13 +1159,13 @@ export function createSetupContext(
11521159 if ( __DEV__ ) {
11531160 // We use getters in dev in case libs like test-utils overwrite instance
11541161 // properties (overwrites should not be done in prod)
1155- let attrsProxy : Data
1162+ let attrsProxy : Attrs
11561163 let slotsProxy : Slots
11571164 return Object . freeze ( {
11581165 get attrs ( ) {
11591166 return (
11601167 attrsProxy ||
1161- ( attrsProxy = new Proxy ( instance . attrs , attrsProxyHandlers ) )
1168+ ( attrsProxy = new Proxy ( instance . attrs , attrsProxyHandlers ) as Attrs )
11621169 )
11631170 } ,
11641171 get slots ( ) {
@@ -1171,7 +1178,7 @@ export function createSetupContext(
11711178 } )
11721179 } else {
11731180 return {
1174- attrs : new Proxy ( instance . attrs , attrsProxyHandlers ) ,
1181+ attrs : new Proxy ( instance . attrs , attrsProxyHandlers ) as Attrs ,
11751182 slots : instance . slots ,
11761183 emit : instance . emit ,
11771184 expose,
0 commit comments