mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
[react-loadable-visibility] add types for react-loadable-visibility[react-loadable-visibility] add types for react-loadable-visibility (#37908)
This commit is contained in:
parent
2ec7a2b814
commit
ff9f9a1aa1
8
types/react-loadable-visibility/index.d.ts
vendored
Normal file
8
types/react-loadable-visibility/index.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Type definitions for react-loadable-visibility 3.0
|
||||
// Project: https://github.com/stratiformltd/react-loadable-visibility#readme
|
||||
// Definitions by: Daniel Bartholomae <https://github.com/dbartholomae>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import Loadable from './loadable-components';
|
||||
export default Loadable;
|
||||
2
types/react-loadable-visibility/loadable-components.d.ts
vendored
Normal file
2
types/react-loadable-visibility/loadable-components.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import Loadable from '@loadable/component';
|
||||
export default Loadable;
|
||||
@ -0,0 +1,47 @@
|
||||
import * as React from 'react';
|
||||
import LoadableComponentVisibilityAsDefaultImport from 'react-loadable-visibility';
|
||||
import LoadableComponentVisibility from 'react-loadable-visibility/loadable-components';
|
||||
import ReactLoadableVisibility from 'react-loadable-visibility/react-loadable';
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
}
|
||||
|
||||
const TestComponent: React.FunctionComponent<Props> = ({ title }) => {
|
||||
return <div>{title} component</div>;
|
||||
};
|
||||
|
||||
const testComponentModule = Promise.resolve(TestComponent);
|
||||
|
||||
function Loading() {
|
||||
return <div>Loading...</div>;
|
||||
}
|
||||
|
||||
const LoadableComponentAsDefaultImportComponent = LoadableComponentVisibilityAsDefaultImport(
|
||||
() => testComponentModule,
|
||||
{
|
||||
fallback: <Loading />,
|
||||
},
|
||||
);
|
||||
|
||||
const LoadableComponentComponent = LoadableComponentVisibility(
|
||||
() => testComponentModule,
|
||||
{
|
||||
fallback: <Loading />,
|
||||
},
|
||||
);
|
||||
|
||||
const ReactLoadableComponent = ReactLoadableVisibility({
|
||||
loader: () => testComponentModule,
|
||||
loading: Loading,
|
||||
});
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div>
|
||||
<LoadableComponentAsDefaultImportComponent title='test' />
|
||||
<LoadableComponentComponent title='test' />
|
||||
<ReactLoadableComponent title='test' />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
2
types/react-loadable-visibility/react-loadable.d.ts
vendored
Normal file
2
types/react-loadable-visibility/react-loadable.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import * as Loadable from 'react-loadable';
|
||||
export default Loadable;
|
||||
31
types/react-loadable-visibility/tsconfig.json
Normal file
31
types/react-loadable-visibility/tsconfig.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@loadable/component": [
|
||||
"loadable__component"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"loadable-components.d.ts",
|
||||
"react-loadable.d.ts",
|
||||
"react-loadable-visibility-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-loadable-visibility/tslint.json
Normal file
1
types/react-loadable-visibility/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user