@@ -2,7 +2,7 @@ import { expectTypeOf } from 'expect-type'
2
2
import type { ComponentType } from 'react'
3
3
import { describe , expect , test } from 'vitest'
4
4
5
- import type { DataItemProps } from '../src'
5
+ import type { DataItemProps , Path } from '../src'
6
6
import { applyValue , createDataType , isCycleReference } from '../src'
7
7
import { segmentArray } from '../src/utils'
8
8
@@ -95,17 +95,10 @@ describe('function createDataType', () => {
95
95
}
96
96
)
97
97
expectTypeOf ( dataType ) . toEqualTypeOf < {
98
- is :( value : unknown ) => value is string
98
+ is :( value : unknown , path : Path ) => value is string
99
99
Component : ComponentType < DataItemProps < string > >
100
100
} > ( )
101
- const someValue : unknown = null
102
101
expectTypeOf ( dataType . is ) . returns . toBeBoolean ( )
103
- if ( dataType . is ( someValue ) ) {
104
- expectTypeOf ( someValue ) . toMatchTypeOf < string > ( )
105
- } else {
106
- expectTypeOf ( someValue ) . not . toMatchTypeOf < string > ( )
107
- expectTypeOf ( someValue ) . toMatchTypeOf < unknown > ( )
108
- }
109
102
expect ( dataType . is ) . toBeTypeOf ( 'function' )
110
103
expect ( dataType . Component ) . toBeTypeOf ( 'function' )
111
104
} )
@@ -125,7 +118,7 @@ describe('function createDataType', () => {
125
118
}
126
119
)
127
120
expectTypeOf ( dataType ) . toEqualTypeOf < {
128
- is :( value : unknown ) => value is string
121
+ is :( value : unknown , path : Path ) => value is string
129
122
Component : ComponentType < DataItemProps < string > >
130
123
Editor : ComponentType < DataItemProps < string > >
131
124
} > ( )
@@ -155,7 +148,7 @@ describe('function createDataType', () => {
155
148
}
156
149
)
157
150
expectTypeOf ( dataType ) . toEqualTypeOf < {
158
- is :( value : unknown ) => value is string
151
+ is :( value : unknown , path : Path ) => value is string
159
152
Component : ComponentType < DataItemProps < string > >
160
153
PreComponent : ComponentType < DataItemProps < string > >
161
154
PostComponent : ComponentType < DataItemProps < string > >
@@ -191,7 +184,7 @@ describe('function createDataType', () => {
191
184
}
192
185
)
193
186
expectTypeOf ( dataType ) . toEqualTypeOf < {
194
- is :( value : unknown ) => value is string
187
+ is :( value : unknown , path : Path ) => value is string
195
188
Component : ComponentType < DataItemProps < string > >
196
189
Editor : ComponentType < DataItemProps < string > >
197
190
PreComponent : ComponentType < DataItemProps < string > >
0 commit comments