mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for react-gateway@2.8 (#27029)
* Add types for react-gateway@2.8 * Fix linting * Remove unnecessary lib folder
This commit is contained in:
parent
9c7050dd4c
commit
9e79023693
9
types/react-gateway/Gateway.d.ts
vendored
Normal file
9
types/react-gateway/Gateway.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare namespace Gateway {
|
||||
interface GatewayProps {
|
||||
into: string;
|
||||
}
|
||||
}
|
||||
declare class Gateway extends React.Component<Gateway.GatewayProps> { }
|
||||
export = Gateway;
|
||||
11
types/react-gateway/GatewayDest.d.ts
vendored
Normal file
11
types/react-gateway/GatewayDest.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare namespace GatewayDest {
|
||||
interface GatewayDestProps {
|
||||
name: string;
|
||||
tagName?: string;
|
||||
component?: string | React.Component;
|
||||
}
|
||||
}
|
||||
declare class GatewayDest extends React.Component<GatewayDest.GatewayDestProps> { }
|
||||
export = GatewayDest;
|
||||
4
types/react-gateway/GatewayProvider.d.ts
vendored
Normal file
4
types/react-gateway/GatewayProvider.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare class GatewayProvider extends React.Component { }
|
||||
export = GatewayProvider;
|
||||
20
types/react-gateway/GatewayRegistry.d.ts
vendored
Normal file
20
types/react-gateway/GatewayRegistry.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
declare class GatewayRegistry {
|
||||
_containers: { [name: string]: React.Component | null | undefined };
|
||||
_children: { [name: string]: { [gatewayId: string]: React.ReactNode } | undefined };
|
||||
_currentId: number;
|
||||
|
||||
_renderContainer(name: string): void;
|
||||
|
||||
addContainer(name: string, container: React.Component): void;
|
||||
|
||||
removeContainer(name: string): void;
|
||||
|
||||
addChild(name: string, gatewayId: string, child: React.ReactNode): void;
|
||||
|
||||
clearChild(name: string, gatewayId: string): void;
|
||||
|
||||
register(name: string, child: React.ReactNode): string;
|
||||
|
||||
unregister(name: string, gatewayId: string): void;
|
||||
}
|
||||
export = GatewayRegistry;
|
||||
21
types/react-gateway/index.d.ts
vendored
Normal file
21
types/react-gateway/index.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Type definitions for react-gateway 2.8
|
||||
// Project: https://github.com/cloudflare/react-gateway
|
||||
// Definitions by: Jason Unger <https://github.com/jsonunger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import Gateway = require('./Gateway');
|
||||
import { GatewayProps } from './Gateway';
|
||||
import GatewayDest = require('./GatewayDest');
|
||||
import { GatewayDestProps } from './GatewayDest';
|
||||
import GatewayProvider = require('./GatewayProvider');
|
||||
import GatewayRegistry = require('./GatewayRegistry');
|
||||
|
||||
export {
|
||||
Gateway,
|
||||
GatewayProps,
|
||||
GatewayDest,
|
||||
GatewayDestProps,
|
||||
GatewayProvider,
|
||||
GatewayRegistry
|
||||
};
|
||||
36
types/react-gateway/react-gateway-tests.tsx
Normal file
36
types/react-gateway/react-gateway-tests.tsx
Normal file
@ -0,0 +1,36 @@
|
||||
import * as React from 'react';
|
||||
import { Gateway, GatewayProvider, GatewayDest } from 'react-gateway';
|
||||
|
||||
class ReactGateway extends React.Component<Gateway.GatewayProps> {
|
||||
render() {
|
||||
return (
|
||||
<Gateway {...this.props}>
|
||||
<div>
|
||||
Text goes here.
|
||||
</div>
|
||||
</Gateway>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ReactGatewayProvider extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<GatewayProvider>
|
||||
<GatewayDest name="test" />
|
||||
<div>
|
||||
All the way down...
|
||||
<div>
|
||||
Almost there...
|
||||
<div>
|
||||
Getting close...
|
||||
<div>
|
||||
<ReactGateway into="test" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</GatewayProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
28
types/react-gateway/tsconfig.json
Normal file
28
types/react-gateway/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"Gateway.d.ts",
|
||||
"GatewayDest.d.ts",
|
||||
"GatewayProvider.d.ts",
|
||||
"GatewayRegistry.d.ts",
|
||||
"index.d.ts",
|
||||
"react-gateway-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-gateway/tslint.json
Normal file
1
types/react-gateway/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user