mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
36 lines
848 B
TypeScript
36 lines
848 B
TypeScript
//// [tests/cases/compiler/ignoredJsxAttributes.tsx] ////
|
|
|
|
//// [ignoredJsxAttributes.tsx]
|
|
/// <reference path="/.lib/react16.d.ts" />
|
|
|
|
// Repro from #44797
|
|
|
|
import * as React from "react";
|
|
|
|
interface Props {
|
|
foo: string;
|
|
[dataProp: string]: string;
|
|
}
|
|
|
|
declare function Yadda(props: Props): JSX.Element;
|
|
|
|
let props: Props = {
|
|
foo: "",
|
|
"data-yadda": 42, // Error
|
|
};
|
|
|
|
let x1 = <Yadda foo="hello" data-yadda={42}/>;
|
|
let x2 = <Yadda bar="hello" data-yadda={42}/>; // Error
|
|
|
|
|
|
//// [ignoredJsxAttributes.js]
|
|
/// <reference path="/.lib/react16.d.ts" />
|
|
// Repro from #44797
|
|
import * as React from "react";
|
|
let props = {
|
|
foo: "",
|
|
"data-yadda": 42, // Error
|
|
};
|
|
let x1 = React.createElement(Yadda, { foo: "hello", "data-yadda": 42 });
|
|
let x2 = React.createElement(Yadda, { bar: "hello", "data-yadda": 42 }); // Error
|