mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Added multiline tests
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
tests/cases/conformance/directives/a.ts(10,1): error TS2578: Unused '@ts-expect-error' directive.
|
||||
tests/cases/conformance/directives/b.tsx(26,1): error TS2578: Unused '@ts-expect-error' directive.
|
||||
|
||||
|
||||
==== tests/cases/conformance/directives/a.ts (1 errors) ====
|
||||
/**
|
||||
@ts-ignore */
|
||||
export let x: string = 100;
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let y: string = 100;
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2578: Unused '@ts-expect-error' directive.
|
||||
export let ok = 100;
|
||||
|
||||
==== tests/cases/conformance/directives/b.tsx (1 errors) ====
|
||||
import * as React from "react";
|
||||
|
||||
export function MyComponent(props: { foo: string }) {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
let x = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-ignore */}
|
||||
<MyComponent foo={100} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
let y = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={100} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
let ok = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2578: Unused '@ts-expect-error' directive.
|
||||
<MyComponent foo={"hooray"} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//// [tests/cases/conformance/directives/multiline.tsx] ////
|
||||
|
||||
//// [a.ts]
|
||||
/**
|
||||
@ts-ignore */
|
||||
export let x: string = 100;
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let y: string = 100;
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let ok = 100;
|
||||
|
||||
//// [b.tsx]
|
||||
import * as React from "react";
|
||||
|
||||
export function MyComponent(props: { foo: string }) {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
let x = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-ignore */}
|
||||
<MyComponent foo={100} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
let y = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={100} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
let ok = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={"hooray"} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.ok = exports.y = exports.x = void 0;
|
||||
/**
|
||||
@ts-ignore */
|
||||
exports.x = 100;
|
||||
/**
|
||||
@ts-expect-error */
|
||||
exports.y = 100;
|
||||
/**
|
||||
@ts-expect-error */
|
||||
exports.ok = 100;
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
exports.MyComponent = void 0;
|
||||
var React = require("react");
|
||||
function MyComponent(props) {
|
||||
return React.createElement("div", null);
|
||||
}
|
||||
exports.MyComponent = MyComponent;
|
||||
var x = (React.createElement("div", null,
|
||||
React.createElement(MyComponent, { foo: 100 }),
|
||||
";"));
|
||||
var y = (React.createElement("div", null,
|
||||
React.createElement(MyComponent, { foo: 100 }),
|
||||
";"));
|
||||
var ok = (React.createElement("div", null,
|
||||
React.createElement(MyComponent, { foo: "hooray" }),
|
||||
";"));
|
||||
@@ -0,0 +1,80 @@
|
||||
=== tests/cases/conformance/directives/a.ts ===
|
||||
/**
|
||||
@ts-ignore */
|
||||
export let x: string = 100;
|
||||
>x : Symbol(x, Decl(a.ts, 2, 10))
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let y: string = 100;
|
||||
>y : Symbol(y, Decl(a.ts, 6, 10))
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let ok = 100;
|
||||
>ok : Symbol(ok, Decl(a.ts, 10, 10))
|
||||
|
||||
=== tests/cases/conformance/directives/b.tsx ===
|
||||
import * as React from "react";
|
||||
>React : Symbol(React, Decl(b.tsx, 0, 6))
|
||||
|
||||
export function MyComponent(props: { foo: string }) {
|
||||
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
|
||||
>props : Symbol(props, Decl(b.tsx, 2, 28))
|
||||
>foo : Symbol(foo, Decl(b.tsx, 2, 36))
|
||||
|
||||
return <div />;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
let x = (
|
||||
>x : Symbol(x, Decl(b.tsx, 6, 3))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
{/*
|
||||
@ts-ignore */}
|
||||
<MyComponent foo={100} />;
|
||||
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
|
||||
>foo : Symbol(foo, Decl(b.tsx, 10, 16))
|
||||
|
||||
</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
);
|
||||
|
||||
let y = (
|
||||
>y : Symbol(y, Decl(b.tsx, 14, 3))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={100} />;
|
||||
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
|
||||
>foo : Symbol(foo, Decl(b.tsx, 18, 16))
|
||||
|
||||
</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
);
|
||||
|
||||
let ok = (
|
||||
>ok : Symbol(ok, Decl(b.tsx, 22, 3))
|
||||
|
||||
<div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={"hooray"} />;
|
||||
>MyComponent : Symbol(MyComponent, Decl(b.tsx, 0, 31))
|
||||
>foo : Symbol(foo, Decl(b.tsx, 26, 16))
|
||||
|
||||
</div>
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
|
||||
);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
=== tests/cases/conformance/directives/a.ts ===
|
||||
/**
|
||||
@ts-ignore */
|
||||
export let x: string = 100;
|
||||
>x : string
|
||||
>100 : 100
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let y: string = 100;
|
||||
>y : string
|
||||
>100 : 100
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let ok = 100;
|
||||
>ok : number
|
||||
>100 : 100
|
||||
|
||||
=== tests/cases/conformance/directives/b.tsx ===
|
||||
import * as React from "react";
|
||||
>React : typeof React
|
||||
|
||||
export function MyComponent(props: { foo: string }) {
|
||||
>MyComponent : (props: { foo: string;}) => JSX.Element
|
||||
>props : { foo: string; }
|
||||
>foo : string
|
||||
|
||||
return <div />;
|
||||
><div /> : JSX.Element
|
||||
>div : any
|
||||
}
|
||||
|
||||
let x = (
|
||||
>x : JSX.Element
|
||||
>( <div> {/* @ts-ignore */} <MyComponent foo={100} />; </div>) : JSX.Element
|
||||
|
||||
<div>
|
||||
><div> {/* @ts-ignore */} <MyComponent foo={100} />; </div> : JSX.Element
|
||||
>div : any
|
||||
|
||||
{/*
|
||||
@ts-ignore */}
|
||||
<MyComponent foo={100} />;
|
||||
><MyComponent foo={100} /> : JSX.Element
|
||||
>MyComponent : (props: { foo: string; }) => JSX.Element
|
||||
>foo : number
|
||||
>100 : 100
|
||||
|
||||
</div>
|
||||
>div : any
|
||||
|
||||
);
|
||||
|
||||
let y = (
|
||||
>y : JSX.Element
|
||||
>( <div> {/* @ts-expect-error */} <MyComponent foo={100} />; </div>) : JSX.Element
|
||||
|
||||
<div>
|
||||
><div> {/* @ts-expect-error */} <MyComponent foo={100} />; </div> : JSX.Element
|
||||
>div : any
|
||||
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={100} />;
|
||||
><MyComponent foo={100} /> : JSX.Element
|
||||
>MyComponent : (props: { foo: string; }) => JSX.Element
|
||||
>foo : number
|
||||
>100 : 100
|
||||
|
||||
</div>
|
||||
>div : any
|
||||
|
||||
);
|
||||
|
||||
let ok = (
|
||||
>ok : JSX.Element
|
||||
>( <div> {/* @ts-expect-error */} <MyComponent foo={"hooray"} />; </div>) : JSX.Element
|
||||
|
||||
<div>
|
||||
><div> {/* @ts-expect-error */} <MyComponent foo={"hooray"} />; </div> : JSX.Element
|
||||
>div : any
|
||||
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={"hooray"} />;
|
||||
><MyComponent foo={"hooray"} /> : JSX.Element
|
||||
>MyComponent : (props: { foo: string; }) => JSX.Element
|
||||
>foo : string
|
||||
>"hooray" : "hooray"
|
||||
|
||||
</div>
|
||||
>div : any
|
||||
|
||||
);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// @filename: a.ts
|
||||
/**
|
||||
@ts-ignore */
|
||||
export let x: string = 100;
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let y: string = 100;
|
||||
|
||||
/**
|
||||
@ts-expect-error */
|
||||
export let ok = 100;
|
||||
|
||||
// @filename: b.tsx
|
||||
// @jsx: react
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
import * as React from "react";
|
||||
|
||||
export function MyComponent(props: { foo: string }) {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
let x = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-ignore */}
|
||||
<MyComponent foo={100} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
let y = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={100} />;
|
||||
</div>
|
||||
);
|
||||
|
||||
let ok = (
|
||||
<div>
|
||||
{/*
|
||||
@ts-expect-error */}
|
||||
<MyComponent foo={"hooray"} />;
|
||||
</div>
|
||||
);
|
||||
Reference in New Issue
Block a user