Skip to content

Commit 992441d

Browse files
Added multiline tests
1 parent a21477d commit 992441d

File tree

5 files changed

+351
-0
lines changed

5 files changed

+351
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
tests/cases/conformance/directives/a.ts(10,1): error TS2578: Unused '@ts-expect-error' directive.
2+
tests/cases/conformance/directives/b.tsx(26,1): error TS2578: Unused '@ts-expect-error' directive.
3+
4+
5+
==== tests/cases/conformance/directives/a.ts (1 errors) ====
6+
/**
7+
@ts-ignore */
8+
export let x: string = 100;
9+
10+
/**
11+
@ts-expect-error */
12+
export let y: string = 100;
13+
14+
/**
15+
@ts-expect-error */
16+
~~~~~~~~~~~~~~~~~~~~
17+
!!! error TS2578: Unused '@ts-expect-error' directive.
18+
export let ok = 100;
19+
20+
==== tests/cases/conformance/directives/b.tsx (1 errors) ====
21+
import * as React from "react";
22+
23+
export function MyComponent(props: { foo: string }) {
24+
return <div />;
25+
}
26+
27+
let x = (
28+
<div>
29+
{/*
30+
@ts-ignore */}
31+
<MyComponent foo={100} />;
32+
</div>
33+
);
34+
35+
let y = (
36+
<div>
37+
{/*
38+
@ts-expect-error */}
39+
<MyComponent foo={100} />;
40+
</div>
41+
);
42+
43+
let ok = (
44+
<div>
45+
{/*
46+
@ts-expect-error */}
47+
~~~~~~~~~~~~~~~~~~~~~~
48+
!!! error TS2578: Unused '@ts-expect-error' directive.
49+
<MyComponent foo={"hooray"} />;
50+
</div>
51+
);
52+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
//// [tests/cases/conformance/directives/multiline.tsx] ////
2+
3+
//// [a.ts]
4+
/**
5+
@ts-ignore */
6+
export let x: string = 100;
7+
8+
/**
9+
@ts-expect-error */
10+
export let y: string = 100;
11+
12+
/**
13+
@ts-expect-error */
14+
export let ok = 100;
15+
16+
//// [b.tsx]
17+
import * as React from "react";
18+
19+
export function MyComponent(props: { foo: string }) {
20+
return <div />;
21+
}
22+
23+
let x = (
24+
<div>
25+
{/*
26+
@ts-ignore */}
27+
<MyComponent foo={100} />;
28+
</div>
29+
);
30+
31+
let y = (
32+
<div>
33+
{/*
34+
@ts-expect-error */}
35+
<MyComponent foo={100} />;
36+
</div>
37+
);
38+
39+
let ok = (
40+
<div>
41+
{/*
42+
@ts-expect-error */}
43+
<MyComponent foo={"hooray"} />;
44+
</div>
45+
);
46+
47+
48+
//// [a.js]
49+
"use strict";
50+
exports.__esModule = true;
51+
exports.ok = exports.y = exports.x = void 0;
52+
/**
53+
@ts-ignore */
54+
exports.x = 100;
55+
/**
56+
@ts-expect-error */
57+
exports.y = 100;
58+
/**
59+
@ts-expect-error */
60+
exports.ok = 100;
61+
//// [b.js]
62+
"use strict";
63+
exports.__esModule = true;
64+
exports.MyComponent = void 0;
65+
var React = require("react");
66+
function MyComponent(props) {
67+
return React.createElement("div", null);
68+
}
69+
exports.MyComponent = MyComponent;
70+
var x = (React.createElement("div", null,
71+
React.createElement(MyComponent, { foo: 100 }),
72+
";"));
73+
var y = (React.createElement("div", null,
74+
React.createElement(MyComponent, { foo: 100 }),
75+
";"));
76+
var ok = (React.createElement("div", null,
77+
React.createElement(MyComponent, { foo: "hooray" }),
78+
";"));
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
=== tests/cases/conformance/directives/a.ts ===
2+
/**
3+
@ts-ignore */
4+
export let x: string = 100;
5+
>x : Symbol(x, Decl(a.ts, 2, 10))
6+
7+
/**
8+
@ts-expect-error */
9+
export let y: string = 100;
10+
>y : Symbol(y, Decl(a.ts, 6, 10))
11+
12+
/**
13+
@ts-expect-error */
14+
export let ok = 100;
15+
>ok : Symbol(ok, Decl(a.ts, 10, 10))
16+
17+
=== tests/cases/conformance/directives/b.tsx ===
18+
import * as React from "react";
19+
>React : Symbol(React, Decl(b.tsx, 0, 6))
20+
21+
export function MyComponent(props: { foo: string }) {
22+
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
23+
>props : Symbol(props, Decl(b.tsx, 2, 28))
24+
>foo : Symbol(foo, Decl(b.tsx, 2, 36))
25+
26+
return <div />;
27+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
28+
}
29+
30+
let x = (
31+
>x : Symbol(x, Decl(b.tsx, 6, 3))
32+
33+
<div>
34+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
35+
36+
{/*
37+
@ts-ignore */}
38+
<MyComponent foo={100} />;
39+
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
40+
>foo : Symbol(foo, Decl(b.tsx, 10, 16))
41+
42+
</div>
43+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
44+
45+
);
46+
47+
let y = (
48+
>y : Symbol(y, Decl(b.tsx, 14, 3))
49+
50+
<div>
51+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
52+
53+
{/*
54+
@ts-expect-error */}
55+
<MyComponent foo={100} />;
56+
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
57+
>foo : Symbol(foo, Decl(b.tsx, 18, 16))
58+
59+
</div>
60+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
61+
62+
);
63+
64+
let ok = (
65+
>ok : Symbol(ok, Decl(b.tsx, 22, 3))
66+
67+
<div>
68+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
69+
70+
{/*
71+
@ts-expect-error */}
72+
<MyComponent foo={"hooray"} />;
73+
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
74+
>foo : Symbol(foo, Decl(b.tsx, 26, 16))
75+
76+
</div>
77+
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
78+
79+
);
80+
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
=== tests/cases/conformance/directives/a.ts ===
2+
/**
3+
@ts-ignore */
4+
export let x: string = 100;
5+
>x : string
6+
>100 : 100
7+
8+
/**
9+
@ts-expect-error */
10+
export let y: string = 100;
11+
>y : string
12+
>100 : 100
13+
14+
/**
15+
@ts-expect-error */
16+
export let ok = 100;
17+
>ok : number
18+
>100 : 100
19+
20+
=== tests/cases/conformance/directives/b.tsx ===
21+
import * as React from "react";
22+
>React : typeof React
23+
24+
export function MyComponent(props: { foo: string }) {
25+
>MyComponent : (props: { foo: string;}) => JSX.Element
26+
>props : { foo: string; }
27+
>foo : string
28+
29+
return <div />;
30+
><div /> : JSX.Element
31+
>div : any
32+
}
33+
34+
let x = (
35+
>x : JSX.Element
36+
>( <div> {/* @ts-ignore */} <MyComponent foo={100} />; </div>) : JSX.Element
37+
38+
<div>
39+
><div> {/* @ts-ignore */} <MyComponent foo={100} />; </div> : JSX.Element
40+
>div : any
41+
42+
{/*
43+
@ts-ignore */}
44+
<MyComponent foo={100} />;
45+
><MyComponent foo={100} /> : JSX.Element
46+
>MyComponent : (props: { foo: string; }) => JSX.Element
47+
>foo : number
48+
>100 : 100
49+
50+
</div>
51+
>div : any
52+
53+
);
54+
55+
let y = (
56+
>y : JSX.Element
57+
>( <div> {/* @ts-expect-error */} <MyComponent foo={100} />; </div>) : JSX.Element
58+
59+
<div>
60+
><div> {/* @ts-expect-error */} <MyComponent foo={100} />; </div> : JSX.Element
61+
>div : any
62+
63+
{/*
64+
@ts-expect-error */}
65+
<MyComponent foo={100} />;
66+
><MyComponent foo={100} /> : JSX.Element
67+
>MyComponent : (props: { foo: string; }) => JSX.Element
68+
>foo : number
69+
>100 : 100
70+
71+
</div>
72+
>div : any
73+
74+
);
75+
76+
let ok = (
77+
>ok : JSX.Element
78+
>( <div> {/* @ts-expect-error */} <MyComponent foo={"hooray"} />; </div>) : JSX.Element
79+
80+
<div>
81+
><div> {/* @ts-expect-error */} <MyComponent foo={"hooray"} />; </div> : JSX.Element
82+
>div : any
83+
84+
{/*
85+
@ts-expect-error */}
86+
<MyComponent foo={"hooray"} />;
87+
><MyComponent foo={"hooray"} /> : JSX.Element
88+
>MyComponent : (props: { foo: string; }) => JSX.Element
89+
>foo : string
90+
>"hooray" : "hooray"
91+
92+
</div>
93+
>div : any
94+
95+
);
96+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// @filename: a.ts
2+
/**
3+
@ts-ignore */
4+
export let x: string = 100;
5+
6+
/**
7+
@ts-expect-error */
8+
export let y: string = 100;
9+
10+
/**
11+
@ts-expect-error */
12+
export let ok = 100;
13+
14+
// @filename: b.tsx
15+
// @jsx: react
16+
// @libFiles: react.d.ts,lib.d.ts
17+
import * as React from "react";
18+
19+
export function MyComponent(props: { foo: string }) {
20+
return <div />;
21+
}
22+
23+
let x = (
24+
<div>
25+
{/*
26+
@ts-ignore */}
27+
<MyComponent foo={100} />;
28+
</div>
29+
);
30+
31+
let y = (
32+
<div>
33+
{/*
34+
@ts-expect-error */}
35+
<MyComponent foo={100} />;
36+
</div>
37+
);
38+
39+
let ok = (
40+
<div>
41+
{/*
42+
@ts-expect-error */}
43+
<MyComponent foo={"hooray"} />;
44+
</div>
45+
);

0 commit comments

Comments
 (0)