mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-10 09:40:21 +08:00
Removed "dom" from React types tsconfig.json
This commit is contained in:
5
types/react/global.d.ts
vendored
5
types/react/global.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
React projects that don't include the DOM library need these interfaces to compile.
|
||||
React projects that don't include the DOM library these interfaces need to compile.
|
||||
React Native applications use React, but there is no DOM available. The JavaScript runtime
|
||||
is ES6/ES2015 only. These definitions allow such projects to compile with only `--lib ES6`.
|
||||
*/
|
||||
@@ -33,6 +33,7 @@ interface HTMLBodyElement extends HTMLElement { }
|
||||
interface HTMLBRElement extends HTMLElement { }
|
||||
interface HTMLButtonElement extends HTMLElement { }
|
||||
interface HTMLCanvasElement extends HTMLElement { }
|
||||
interface HTMLDialogElement extends HTMLElement { }
|
||||
interface HTMLDivElement extends HTMLElement { }
|
||||
interface HTMLDListElement extends HTMLElement { }
|
||||
interface HTMLEmbedElement extends HTMLElement { }
|
||||
@@ -175,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
@@ -14,6 +14,7 @@
|
||||
// Stéphane Goetz <https://github.com/onigoetz>
|
||||
// Rich Seviora <https://github.com/richseviora>
|
||||
// Josh Rutherford <https://github.com/theruther4d>
|
||||
// Josh Goldberg <https://github.com/joshuakgoldberg>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -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