mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 09:01:45 +08:00
fix spacing (4 spaces). Implement the test. Add reference to react.d.ts
This commit is contained in:
@@ -277,4 +277,3 @@ class SomeClass extends Component<any, any> {
|
||||
public bar: number;
|
||||
}
|
||||
let bar: number = new (connect()(SomeClass))("foo").bar;
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// Tests for type definitions for react-user-tour
|
||||
// Project: https://github.com/socialtables/react-user-tour
|
||||
// Definitions by: Carlo Cancellieri <https://github.com/ccancellieri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="react-user-tour.d.ts" />
|
||||
57
react-user-tour/react-user-tour-tests.tsx
Normal file
57
react-user-tour/react-user-tour-tests.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
// Tests for type definitions for react-user-tour
|
||||
// Project: https://github.com/socialtables/react-user-tour
|
||||
// Definitions by: Carlo Cancellieri <https://github.com/ccancellieri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="react-user-tour.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
/// <reference path="../react/react-dom.d.ts" />
|
||||
|
||||
import React = require("react");
|
||||
import ReactDOM = require("react-dom");
|
||||
|
||||
import ReactUserTour from "react-user-tour";
|
||||
|
||||
interface State {
|
||||
tourStep:number
|
||||
isTourActive:boolean
|
||||
}
|
||||
|
||||
class TestApp extends React.Component<{}, State> {
|
||||
|
||||
constructor(p:any){
|
||||
super(p)
|
||||
|
||||
this.setState({
|
||||
isTourActive:true,
|
||||
tourStep:1
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const Tour = <ReactUserTour active={this.state.isTourActive}
|
||||
step={this.state.tourStep}
|
||||
onNext={(step:number) => this.setState({tourStep: step, isTourActive: true})}
|
||||
onBack={(step:number) => this.setState({tourStep: step, isTourActive: true})}
|
||||
onCancel={() => this.setState({tourStep: this.state.tourStep, isTourActive: false})}
|
||||
steps={[
|
||||
{
|
||||
step: 1,
|
||||
selector: ".MyClass",
|
||||
title: <div>React User Tour</div>,
|
||||
body: <div>Provide a simple guided tour around a website utilizing css selectors.</div>,
|
||||
position: "bottom"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
|
||||
|
||||
return <div id='test-app' class='.MyClass'>
|
||||
{Tour}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(React.createElement(TestApp, {}), document.getElementById("test-app"));
|
||||
1
react-user-tour/react-user-tour-tests.tsx.tscparams
Normal file
1
react-user-tour/react-user-tour-tests.tsx.tscparams
Normal file
@@ -0,0 +1 @@
|
||||
--noImplicitAny --jsx react
|
||||
42
react-user-tour/react-user-tour.d.ts
vendored
42
react-user-tour/react-user-tour.d.ts
vendored
@@ -3,28 +3,30 @@
|
||||
// Definitions by: Carlo Cancellieri <https://github.com/ccancellieri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
declare module "react-user-tour" {
|
||||
|
||||
// Import React
|
||||
import { HTMLAttributes, ComponentClass } from 'react';
|
||||
|
||||
interface TourStep {
|
||||
step: number
|
||||
selector: string
|
||||
title: string
|
||||
body: string
|
||||
position?: string
|
||||
}
|
||||
// Import React
|
||||
import { HTMLAttributes, ComponentClass } from 'react';
|
||||
|
||||
interface TourProps extends HTMLAttributes {
|
||||
steps:TourStep[]
|
||||
active:boolean
|
||||
step:number
|
||||
onNext:any
|
||||
onBack:any
|
||||
onCancel:any
|
||||
}
|
||||
interface TourStep {
|
||||
step: number
|
||||
selector: string
|
||||
title: string
|
||||
body: string
|
||||
position?: string
|
||||
}
|
||||
|
||||
var ReactUserTour: ComponentClass<TourProps>;
|
||||
export default ReactUserTour
|
||||
interface TourProps extends HTMLAttributes {
|
||||
steps:TourStep[]
|
||||
active:boolean
|
||||
step:number
|
||||
onNext:any
|
||||
onBack:any
|
||||
onCancel:any
|
||||
}
|
||||
|
||||
var ReactUserTour: ComponentClass<TourProps>;
|
||||
export default ReactUserTour
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user