feat: add type definitions for react-router-tabs (#41981)

This commit is contained in:
Joakim Unge
2020-01-30 13:18:43 -08:00
committed by GitHub
parent bd981cad96
commit 74b6a1fcb4
4 changed files with 57 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
// Type definitions for react-router-tabs 1.3
// Project: https://github.com/chacestew/react-router-tabs#readme
// Definitions by: Joakim Unge <https://github.com/joakimunge>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Route, Link, RouteProps } from 'react-router-dom';
import { ReactNode } from 'react';
export type AriaCurrent = 'page' | 'step' | 'location' | 'date' | 'time' | 'true';
export interface NavTabProps {
to: string | object;
replace?: boolean;
exact?: boolean;
strict?: boolean;
activeClassName?: string;
className?: string;
activeStyle?: object;
style?: object;
'aria-current'?: AriaCurrent;
disabled?: boolean;
}
export interface RoutedTabsProps {
startPathWith?: string;
className?: string;
style?: object;
tabClassName?: string;
activeTabClassName?: string;
tabStyle?: object;
activeTabStyle?: object;
children?: ReactNode;
}
export function NavTab(props: NavTabProps): Route;
export function RoutedTabs(props: RoutedTabsProps): ReactNode;
@@ -0,0 +1,4 @@
import { NavTab, RoutedTabs } from 'react-router-tabs';
NavTab({ to: 'path' }); // $ExpectType Route<RouteProps>
RoutedTabs({}); // $ExpectType ReactNode
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "react-router-tabs-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }