File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -197,8 +197,8 @@ export default abstract class BaseWrapper<ElementType extends Node>
197
197
}
198
198
199
199
attributes ( ) : { [ key : string ] : string }
200
- attributes ( key : string ) : string
201
- attributes ( key ?: string ) : { [ key : string ] : string } | string {
200
+ attributes ( key : string ) : string | undefined
201
+ attributes ( key ?: string ) : { [ key : string ] : string } | string | undefined {
202
202
const attributeMap : Record < string , string > = { }
203
203
if ( isElement ( this . element ) ) {
204
204
const attributes = Array . from ( this . element . attributes )
Original file line number Diff line number Diff line change @@ -99,8 +99,8 @@ export default interface WrapperLike {
99
99
classes ( className ?: string ) : string [ ] | boolean
100
100
101
101
attributes ( ) : { [ key : string ] : string }
102
- attributes ( key : string ) : string
103
- attributes ( key ?: string ) : { [ key : string ] : string } | string
102
+ attributes ( key : string ) : string | undefined
103
+ attributes ( key ?: string ) : { [ key : string ] : string } | string | undefined
104
104
105
105
text ( ) : string
106
106
exists ( ) : boolean
Original file line number Diff line number Diff line change @@ -64,7 +64,8 @@ expectType<Element | undefined>(byClassArray[0].element)
64
64
// emitted
65
65
// event name
66
66
let incrementEvent = wrapper . emitted < { count : number } > ( 'increment' )
67
- expectType < { count : number } > ( incrementEvent [ 0 ] )
67
+ expectType < { count : number } [ ] | undefined > ( incrementEvent )
68
+ expectType < { count : number } > ( incrementEvent ! [ 0 ] )
68
69
69
70
// without event name
70
71
let allEvents = wrapper . emitted ( )
@@ -98,9 +99,9 @@ expectType<Element>(byClass.element)
98
99
99
100
// attributes
100
101
expectType < { [ key : string ] : string } > ( wrapper . attributes ( ) )
101
- expectType < string > ( wrapper . attributes ( 'key' ) )
102
+ expectType < string | undefined > ( wrapper . attributes ( 'key' ) )
102
103
expectType < { [ key : string ] : string } > ( domWrapper . attributes ( ) )
103
- expectType < string > ( domWrapper . attributes ( 'key' ) )
104
+ expectType < string | undefined > ( domWrapper . attributes ( 'key' ) )
104
105
105
106
// classes
106
107
expectType < Array < string > > ( wrapper . classes ( ) )
You can’t perform that action at this time.
0 commit comments