Skip to content

Commit

Permalink
feat: support typescript.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Dec 25, 2020
1 parent 4b210bf commit 5f497ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "A higher order component for loading components with dynamic imports.",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"typings": "types/index.d.ts",
"scripts": {
"watch": "tsbb watch --target react",
"build": "tsbb build --target react",
Expand Down
13 changes: 13 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type Options = {
models: Promise<any>[];
component: Promise<any>[];
LoadingComponent: JSX.Element;
}

declare function dynamicLoadable(options: Options): React.ReactNode;
declare class DynamicLoadable {
setDefaultLoadingComponent(LoadingComponent: React.ReactNode): void;
}

declare let dl: typeof dynamicLoadable & DynamicLoadable;
export default dl;

0 comments on commit 5f497ef

Please sign in to comment.