Skip to content

Commit 0841b8a

Browse files
committed
updated type definitions examples
1 parent 52e1170 commit 0841b8a

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

src/app-typings.d.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
declare const System: any;
22

3-
// example ES Module declaration
3+
// example external ES Module declaration
44
declare module 'example-module' {
5+
6+
// public variables
57
export const exampleVariable: number;
8+
9+
// public functions
610
export function exampleFunction(param: string): boolean;
11+
12+
// default export
713
export default {
814
exampleVariable: exampleVariable,
915
exampleFunction: exampleFunction
1016
};
1117
}
1218

13-
// example of external React Component declaration
14-
declare module 'example-react-external-component' {
19+
// example external React Module declaration
20+
declare module 'example-react-module' {
1521
import * as React from 'react';
1622

17-
export function fetchData(name: string): Promise<string[]>;
18-
19-
export class ReactExternalComponent extends React.Component<IProps, any> { }
20-
interface IProps {
23+
// public components
24+
interface ReactComponentProps extends React.Props<ReactComponent> {
2125
name: string;
2226
age: number;
2327
}
28+
export class ReactComponent extends React.Component<ReactComponentProps, any> {
29+
static somePrototypeMethod(param: string): boolean;
30+
}
31+
32+
// public functions
33+
export function fetchData(name: string): Promise<string[]>;
2434

35+
// default export
2536
export default {
26-
fetchData: fetchData,
27-
ReactExternalComponent: ReactExternalComponent
37+
ReactComponent: ReactComponent,
38+
fetchData: fetchData
2839
};
2940
}

0 commit comments

Comments
 (0)