Skip to content

Commit

Permalink
Merge pull request #50 from CJY0208/develop
Browse files Browse the repository at this point in the history
修复 .d.ts 对 CacheRoute.when 及 CacheSwitch 的类型定义错误
  • Loading branch information
CJY0208 authored Oct 25, 2019
2 parents 0b38506 + 8b86f7f commit 47b4d0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/// <reference types="react" />
/// <reference types="react-router" />
import * as React from 'react'
import { Switch, SwitchProps, RouteProps } from 'react-router-dom'

export enum When {
FORWARD = 'forward',
BACK = 'back',
ALWAYS = 'always'
}
import { SwitchProps, RouteProps } from 'react-router-dom'

export interface CacheRouteProps extends RouteProps {
className?: string
when?: When | ((props: CacheRouteProps) => boolean)
behavior?: (cached) => object | void
when?: 'forward' | 'back' | 'always' | ((props: CacheRouteProps) => boolean)
behavior?: (isCached: boolean) => object | void
cacheKey?: string
unmount?: boolean
saveScrollPosition?: boolean
Expand All @@ -26,7 +20,7 @@ export interface CacheSwitchProps extends SwitchProps {
which?: (element: React.ElementType) => boolean
}

export declare class CacheSwitch extends Switch<CacheSwitchProps> {}
export declare class CacheSwitch extends React.Component<CacheSwitchProps> {}

export function dropByCacheKey(cacheKey: string): void
export function getCachingKeys(): Array<string>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-router-cache-route",
"version": "1.8.1",
"version": "1.8.2",
"description": "cache-route for react-router base on react v15+ and router v4+",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 47b4d0e

Please sign in to comment.