From 8b86f7f2d7a1622101b172e86b8c9bd0b62409ee Mon Sep 17 00:00:00 2001 From: CJY <375564567@qq.com> Date: Fri, 25 Oct 2019 09:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20.d.ts=20=E5=AF=B9=20CacheR?= =?UTF-8?q?oute.when=20=E5=8F=8A=20CacheSwitch=20=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AE=9A=E4=B9=89=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 14 ++++---------- package.json | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/index.d.ts b/index.d.ts index dda3cdc..c3ae58c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,18 +1,12 @@ /// /// 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 @@ -26,7 +20,7 @@ export interface CacheSwitchProps extends SwitchProps { which?: (element: React.ElementType) => boolean } -export declare class CacheSwitch extends Switch {} +export declare class CacheSwitch extends React.Component {} export function dropByCacheKey(cacheKey: string): void export function getCachingKeys(): Array diff --git a/package.json b/package.json index 68e270f..b78a5ae 100644 --- a/package.json +++ b/package.json @@ -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": {