Skip to content

Commit a0a0545

Browse files
author
Andrew Ross
committed
Merge branch 'vslinko-no-implicit-any'
2 parents 404e9a8 + 3626e33 commit a0a0545

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

examples/auth-flow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const App = React.createClass({
3838
}
3939
},
4040

41-
updateAuth(loggedIn) {
41+
updateAuth(loggedIn:any) {
4242
this.setState({
4343
loggedIn: loggedIn
4444
})
@@ -101,7 +101,7 @@ const Login = React.createClass({
101101
const email = this.refs.email.value
102102
const pass = this.refs.pass.value
103103

104-
auth.login(email, pass, (loggedIn) => {
104+
auth.login(email, pass, (loggedIn:any) => {
105105
if (!loggedIn)
106106
return this.setState({ error: true })
107107

@@ -145,7 +145,7 @@ const Logout = React.createClass({
145145
}
146146
})
147147

148-
function requireAuth(nextState, replace) {
148+
function requireAuth(nextState:any, replace:any) {
149149
if (!auth.loggedIn()) {
150150
replace({
151151
pathname: '/login',

examples/auth.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export = {
2-
login(email?, pass?, cb?) {
2+
login(email?:any, pass?:any, cb?:any) {
33
cb = arguments[arguments.length - 1]
44
if (localStorage['token']) {
55
if (cb) cb(true);
66
this.onChange(true)
77
return
88
}
9-
pretendRequest(email, pass, (res) => {
9+
pretendRequest(email, pass, (res:any) => {
1010
if (res.authenticated) {
1111
localStorage['token'] = res.token
1212
if (cb) cb(true)
@@ -22,7 +22,7 @@ export = {
2222
return localStorage['token']
2323
},
2424

25-
logout(cb?) {
25+
logout(cb?:any) {
2626
delete localStorage['token']
2727
if (cb) cb()
2828
this.onChange(false)
@@ -35,7 +35,7 @@ export = {
3535
onChange() {}
3636
}
3737

38-
function pretendRequest(email, pass, cb) {
38+
function pretendRequest(email:any, pass:any, cb:any) {
3939
setTimeout(() => {
4040
if (email === '[email protected]' && pass === 'password1') {
4141
cb({

examples/breadcrumbs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class App extends React.Component<IInjectedProps, any> {
6666
class Products extends React.Component<{}, {}> {
6767

6868
static title = 'Products'
69-
path = '/products'
69+
static path = '/products'
7070

7171
render() {
7272
return (

examples/confirmation-navigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ const Form = React.createClass({
7373
return 'You have unsaved information, are you sure you want to leave this page?'
7474
},
7575

76-
handleChange(event) {
76+
handleChange(event:any) {
7777
this.setState({
7878
textValue: event.target.value
7979
})
8080
},
8181

82-
handleSubmit(event) {
82+
handleSubmit(event:any) {
8383
event.preventDefault()
8484

8585
this.setState({

react-router.d.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ declare module ReactRouter {
6767
*
6868
* @param {Object} queryObject
6969
*/
70-
stringifyQuery?(queryObject: Object);
70+
stringifyQuery?(queryObject: Object): string;
7171

7272

7373
/**
@@ -82,12 +82,12 @@ declare module ReactRouter {
8282
*
8383
* @param {Error} error
8484
*/
85-
onError?(error: Error);
85+
onError?(error: Error): void;
8686

8787
/**
8888
* Called whenever the router updates its state in response to URL changes.
8989
*/
90-
onUpdate?();
90+
onUpdate?(): void;
9191

9292
/**
9393
* This is primarily for integrating with other libraries that need to participate in rendering before the route components are rendered. It defaults to render={(props) => <RouterContext {...props} />}.
@@ -165,7 +165,7 @@ declare module ReactRouter {
165165
*
166166
* @param {React.MouseEvent} event **NOTE** I'm assuming this will be a click event.
167167
*/
168-
onClick?(event: React.MouseEvent);
168+
onClick?(event: React.MouseEvent): any;
169169
}
170170

171171
/**
@@ -228,47 +228,47 @@ declare module ReactRouter {
228228
*
229229
* @param {LocationDescriptor} pathOrLoc
230230
*/
231-
push(pathOrLoc: LocationDescriptor);
231+
push(pathOrLoc: LocationDescriptor): void;
232232

233233
/**
234234
* Identical to push except replaces the current history entry with a new one.
235235
*
236236
* @param {LocationDescriptor} pathOrLoc
237237
*/
238-
replace(pathOrLoc: LocationDescriptor);
238+
push(pathOrLoc: LocationDescriptor): void;
239239

240240
/**
241241
* Go forward or backward in the history by n or -n.
242242
*
243243
* @param {number} n
244244
*/
245-
go(n: number);
245+
go(n: number): void;
246246

247247
/**
248248
* Go back one entry in the history.
249249
*/
250-
goBack();
250+
goBack(): void;
251251

252252
/**
253253
* Go forward one entry in the history.
254254
*/
255-
goForward();
255+
goForward(): void;
256256

257257
/**
258258
* Stringifies the query into the pathname, using the router's config.
259259
*
260260
* @param {LocationDescriptor} pathOrLoc
261261
* @param {Query} query
262262
*/
263-
createPath(pathOrLoc: LocationDescriptor, query: Query);
263+
createPath(pathOrLoc: LocationDescriptor, query: Query): void;
264264

265265
/**
266266
* Creates a URL, using the router's config. For example, it will add #/ in front of the pathname for hash history.
267267
*
268268
* @param {LocationDescriptor} pathOrLoc
269269
* @param {Query} query
270270
*/
271-
createHref(pathOrLoc: LocationDescriptor, query: Query);
271+
createHref(pathOrLoc: LocationDescriptor, query: Query): void;
272272

273273
/**
274274
* Returns true or false depending on if the pathOrLoc is active. Will be true for every route in the route branch matched (child route is active, therefore parent is too), unless indexOnly is specified, in which case it will only match the exact path.
@@ -361,7 +361,7 @@ declare module ReactRouter {
361361
* @param {Location} location
362362
* @param {(err: Error, routes: PlainRoute[]) => void} callback
363363
*/
364-
getChildRoutes?(location: Location, callback: (err: Error, routes: PlainRoute[]) => void);
364+
getChildRoutes?(location: Location, callback: (err: Error, routes: PlainRoute[]) => void): void;
365365

366366
/**
367367
* The index route. This is the same as specifying an <IndexRoute> child when using JSX route configs.
@@ -394,7 +394,8 @@ declare module ReactRouter {
394394
* @param {Location} location
395395
* @param {(err: Error, route: PlainRoute) => void} callback
396396
*/
397-
getIndexRoute?(location: Location, callback: (err: Error, route: PlainRoute) => void);
397+
398+
getIndexRoute?(location: Location, callback: (err: Error, route: PlainRoute) => void): void;
398399
}
399400

400401
export interface IRedirectProps extends IIndexRedirectProps {
@@ -504,7 +505,7 @@ declare module ReactRouter {
504505
* @param {Location} location
505506
* @param {(error: Error, component: Component<any>) => void} callback
506507
*/
507-
getComponent?(location: Location, callback: (error: Error, component: ReactComponent<any>) => void);
508+
getComponent?(location: Location, callback: (error: Error, component: ReactComponent<any>) => void): void;
508509

509510
/**
510511
* Same as components but asynchronous, useful for code-splitting.
@@ -517,7 +518,7 @@ declare module ReactRouter {
517518
* @param {Location} location
518519
* @param {(error: Error, components: { [name: string]: Component<any> }) => void} callback
519520
*/
520-
getComponent?(location: Location, callback: (error: Error, components: { [name: string]: ReactComponent<any> }) => void);
521+
getComponent?(location: Location, callback: (error: Error, components: { [name: string]: ReactComponent<any> }) => void): void;
521522

522523
/**
523524
* Routes can be nested, this.props.children will contain the element created from the child route component. Please refer to the Route Configuration since this is a very critical part of the router's design.
@@ -535,7 +536,7 @@ declare module ReactRouter {
535536
* @param {(location: LocationDescriptor) => void} replace
536537
* @param {() => void} [callback]
537538
*/
538-
onEnter?(nextState: any, replace: (location: LocationDescriptor) => void, callback?: () => void);
539+
onEnter?(nextState: any, replace: (location: LocationDescriptor) => void, callback?: () => void): void;
539540

540541
/**
541542
* Called when a route is about to be exited.
@@ -747,7 +748,7 @@ declare module ReactRouter {
747748
* @param {routes: RouteConfig}
748749
* @param {(error:Error, redirectLocation:Location, renderProps : Object) => void} callback
749750
*/
750-
export function match({routes: RouteConfig}, callback: (error: Error, redirectLocation: Location, renderProps: Object) => void);
751+
export function match({routes: RouteConfig}, callback: (error: Error, redirectLocation: Location, renderProps: Object) => void): void;
751752

752753
/**
753754
* Creates and returns an array of routes from the given object which may be a JSX route, a plain object route, or an array of either.

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
"module": "commonjs",
55
"jsx": "react",
66
"allowSyntheticDefaultImports": true,
7-
"noEmit": true
7+
"noEmit": true,
8+
"noImplicitAny": true
89
},
910
"exclude": [
1011
"typings"
1112
]
12-
}
13+
}

0 commit comments

Comments
 (0)