-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adds the folder test-d/ to contain the types - we are using tsd to check the types - Added a test:types script to package.json - Apparently we need a root index.d.ts for tsd to work tsdjs/tsd#32 (comment)
- Loading branch information
1 parent
6c1d2bd
commit c413735
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
import { expectAssignable, expectType } from 'tsd'; | ||
import { | ||
adminLayerColorsType, | ||
ADMN0_PCODE, | ||
EmptyObject, | ||
FlexComponent, | ||
GREEN_THRESHOLD, | ||
JurisdictionTypes, | ||
ORANGE_THRESHOLD, | ||
YELLOW_THRESHOLD, | ||
} from '../configs/types'; | ||
|
||
expectType<EmptyObject>({}); | ||
|
||
expectType<GREEN_THRESHOLD>(0.9); | ||
expectType<YELLOW_THRESHOLD>(0.2); | ||
expectType<ORANGE_THRESHOLD>(0.8); | ||
|
||
expectAssignable<ADMN0_PCODE>('TH'); | ||
expectAssignable<ADMN0_PCODE>('ZM'); | ||
expectAssignable<ADMN0_PCODE>('ra Zambia'); | ||
expectAssignable<ADMN0_PCODE>('NA'); | ||
expectAssignable<ADMN0_PCODE>('BW'); | ||
expectAssignable<ADMN0_PCODE>('Chadiza'); | ||
expectAssignable<ADMN0_PCODE>('Sinda'); | ||
expectAssignable<ADMN0_PCODE>('Katete'); | ||
expectAssignable<ADMN0_PCODE>('Siavonga'); | ||
expectAssignable<ADMN0_PCODE>('Lop Buri'); | ||
expectAssignable<ADMN0_PCODE>('Oddar Meanchey Province'); | ||
expectAssignable<ADMN0_PCODE>('Lusaka'); | ||
|
||
expectAssignable<adminLayerColorsType>('black'); | ||
expectAssignable<adminLayerColorsType>('red'); | ||
expectAssignable<adminLayerColorsType>('orange'); | ||
expectAssignable<adminLayerColorsType>('yellow'); | ||
expectAssignable<adminLayerColorsType>('green'); | ||
|
||
expectAssignable<JurisdictionTypes>('administrative'); | ||
expectAssignable<JurisdictionTypes>('operational'); | ||
|
||
class SampleComponent extends React.Component<{}> { | ||
public render() { | ||
return null; | ||
} | ||
} | ||
|
||
expectAssignable<FlexComponent<{}>>(SampleComponent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,5 @@ | |
"noEmit": true, | ||
"jsx": "preserve" | ||
}, | ||
"include": ["src"] | ||
} | ||
"include": ["src", "index.d.ts"] | ||
} |