mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-08 06:42:22 +08:00
Merge pull request #23807 from JoshuaKGoldberg/react-no-lib
Removed "dom" from React types tsconfig.json
This commit is contained in:
2
types/react/global.d.ts
vendored
2
types/react/global.d.ts
vendored
@@ -176,3 +176,5 @@ interface SVGTextPathElement extends SVGElement { }
|
||||
interface SVGTSpanElement extends SVGElement { }
|
||||
interface SVGUseElement extends SVGElement { }
|
||||
interface SVGViewElement extends SVGElement { }
|
||||
|
||||
interface TouchList { }
|
||||
|
||||
1
types/react/index.d.ts
vendored
1
types/react/index.d.ts
vendored
@@ -15,6 +15,7 @@
|
||||
// Rich Seviora <https://github.com/richseviora>
|
||||
// Josh Rutherford <https://github.com/theruther4d>
|
||||
// Guilherme Hübner <https://github.com/guilhermehubner>
|
||||
// Josh Goldberg <https://github.com/joshuakgoldberg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ const props: Props & React.ClassAttributes<{}> = {
|
||||
foo: 42
|
||||
};
|
||||
|
||||
const container: Element = document.createElement("div");
|
||||
declare const container: Element;
|
||||
|
||||
//
|
||||
// Top-Level API
|
||||
@@ -226,9 +226,9 @@ const clonedSvgElement: React.ReactSVGElement =
|
||||
const component: ModernComponent = ReactDOM.render(element, container);
|
||||
const componentNullContainer: ModernComponent = ReactDOM.render(element, null);
|
||||
|
||||
const componentElementOrNull: ModernComponent = ReactDOM.render(element, document.getElementById("anelement"));
|
||||
const componentElementOrNull: ModernComponent = ReactDOM.render(element, container);
|
||||
const componentNoState: ModernComponentNoState = ReactDOM.render(elementNoState, container);
|
||||
const componentNoStateElementOrNull: ModernComponentNoState = ReactDOM.render(elementNoState, document.getElementById("anelement"));
|
||||
const componentNoStateElementOrNull: ModernComponentNoState = ReactDOM.render(elementNoState, container);
|
||||
const domComponent: Element = ReactDOM.render(domElement, container);
|
||||
|
||||
// Other Top-Level API
|
||||
@@ -313,7 +313,7 @@ const htmlAttr: React.HTMLProps<HTMLElement> = {
|
||||
event.stopPropagation();
|
||||
},
|
||||
onAnimationStart: event => {
|
||||
console.log(event.currentTarget.className);
|
||||
const currentTarget: EventTarget & HTMLElement = event.currentTarget;
|
||||
},
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: "<strong>STRONG</strong>"
|
||||
@@ -624,7 +624,7 @@ if (TestUtils.isElementOfType(emptyElement2, StatelessComponent)) {
|
||||
}
|
||||
|
||||
if (TestUtils.isDOMComponent(container)) {
|
||||
container.getAttribute("className");
|
||||
const reassignedContainer: Element = container;
|
||||
} else if (TestUtils.isCompositeComponent(new ModernComponent({ hello: 'hi', foo: 3 }))) {
|
||||
new ModernComponent({ hello: 'hi', foo: 3 }).props;
|
||||
}
|
||||
@@ -670,7 +670,9 @@ class SyntheticEventTargetValue extends React.Component<{}, { value: string }> {
|
||||
render() {
|
||||
return DOM.textarea({
|
||||
value: this.state.value,
|
||||
onChange: e => this.setState({ value: e.target.value })
|
||||
onChange: e => {
|
||||
const target: HTMLTextAreaElement = e.target;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -678,7 +680,7 @@ class SyntheticEventTargetValue extends React.Component<{}, { value: string }> {
|
||||
DOM.input({
|
||||
onChange: event => {
|
||||
// `event.target` is guaranteed to be HTMLInputElement
|
||||
event.target.value;
|
||||
const target: HTMLInputElement = event.target;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
|
||||
Reference in New Issue
Block a user