File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { transformJsxToString } from './core/convert'
4
4
import { resolveOption , type Options } from './core/options'
5
5
6
6
declare global {
7
+ // @ts -expect-error missing JSX
7
8
const jsxToString : ( element : JSX . Element ) => string
8
9
const jsxRaw : ( variable : any ) => any
9
10
}
Original file line number Diff line number Diff line change @@ -193,13 +193,16 @@ describe('jsxToString', () => {
193
193
} )
194
194
195
195
test ( 'Object/Array Literal' , ( ) => {
196
+ // @ts -ignore
196
197
expect ( jsxToString ( < > { { } } </ > ) ) . toMatchInlineSnapshot ( '"{}"' )
198
+ // @ts -ignore
197
199
expect ( jsxToString ( < > { [ { foo : 'bar' } ] } </ > ) ) . toMatchInlineSnapshot (
198
200
'"[{"foo":"bar"}]"' ,
199
201
)
200
202
} )
201
203
202
204
test ( 'RegExpLiteral' , ( ) => {
205
+ // @ts -ignore
203
206
expect ( jsxToString ( < > { / a ( .* ) / g} </ > ) ) . toMatchInlineSnapshot ( '"/a(.*)/g"' )
204
207
} )
205
208
} )
@@ -214,6 +217,7 @@ describe('jsxToString', () => {
214
217
expect ( jsxToString ( < > { 1 - 2 + 3 / 5 } </ > ) ) . toMatchInlineSnapshot ( '"-0.4"' )
215
218
expect ( jsxToString ( < > { 2 ** 2 } </ > ) ) . toMatchInlineSnapshot ( '"4"' )
216
219
expect ( jsxToString ( < > { false || 2 } </ > ) ) . toMatchInlineSnapshot ( '"2"' )
220
+ // @ts -expect-error
217
221
expect ( jsxToString ( < > { null ?? 'foo' } </ > ) ) . toMatchInlineSnapshot ( '"foo"' )
218
222
expect ( jsxToString ( < > { 1 && ( false || 0.2 ) } </ > ) ) . toMatchInlineSnapshot (
219
223
'"0.2"' ,
@@ -236,7 +240,9 @@ describe('jsxToString', () => {
236
240
} )
237
241
238
242
test ( 'ConditionalExpression' , ( ) => {
243
+ // @ts -expect-error
239
244
expect ( jsxToString ( < > { '1' ? 1 : 2 } </ > ) ) . toMatchInlineSnapshot ( '"1"' )
245
+ // @ts -expect-error
240
246
expect ( jsxToString ( < > { void 1 ? 1 : 2 } </ > ) ) . toMatchInlineSnapshot ( '"2"' )
241
247
} )
242
248
You can’t perform that action at this time.
0 commit comments