Skip to content

Commit

Permalink
Add initial type tests (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus authored and Vadim Demedes committed Sep 21, 2019
1 parent ee143e6 commit d8c6300
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
28 changes: 14 additions & 14 deletions index.d.ts
@@ -1,4 +1,4 @@
import * as React from "react";
import * as React from 'react';

export interface RenderOptions {
/**
Expand Down Expand Up @@ -140,21 +140,21 @@ export interface BoxProps {
readonly margin?: number;
readonly flexGrow?: number;
readonly flexShrink?: number;
readonly flexDirection?: "row" | "row-reverse" | "column" | "column-reverse";
readonly flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
readonly flexBasis?: string | number;
readonly alignItems?: "flex-start" | "center" | "flex-end";
readonly alignItems?: 'flex-start' | 'center' | 'flex-end';
readonly justifyContent?:
| "flex-start"
| "center"
| "flex-end"
| "space-between"
| "space-around";
| 'flex-start'
| 'center'
| 'flex-end'
| 'space-between'
| 'space-around';
readonly textWrap?:
| "wrap"
| "truncate"
| "truncate-start"
| "truncate-middle"
| "truncate-end";
| 'wrap'
| 'truncate'
| 'truncate-start'
| 'truncate-middle'
| 'truncate-end';
}

/**
Expand Down Expand Up @@ -209,7 +209,7 @@ export const StdinContext: React.Context<{
* Ink exposes this function via own `<StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`.
* If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
*/
readonly setRawMode: NodeJS.ReadStream["setRawMode"];
readonly setRawMode: NodeJS.ReadStream['setRawMode'];
}>;

/**
Expand Down
10 changes: 10 additions & 0 deletions index.test-d.tsx
@@ -0,0 +1,10 @@
import * as React from 'react';
import {expectType} from 'tsd';
import {render, Instance, Text} from '.';

const instance = render(<Text>🦄</Text>, {
debug: true
});

expectType<Instance>(instance);
expectType<void>(instance.unmount());
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"build": "babel src --out-dir=build",
"prepare": "npm run build",
"test": "xo && FORCE_COLOR=true ava",
"test": "xo && FORCE_COLOR=true ava && tsd",
"pretest": "npm run build",
"cast": "svg-term --command='node media/demo.js' --out=media/demo.svg --from=100 --window --width=50 --height=8 --term=iterm2 --profile=Snazzy"
},
Expand Down Expand Up @@ -79,6 +79,7 @@
"sinon": "^7.2.7",
"strip-ansi": "^5.2.0",
"svg-term-cli": "^2.1.1",
"tsd": "^0.8.0",
"xo": "^0.24.0"
},
"peerDependencies": {
Expand Down

0 comments on commit d8c6300

Please sign in to comment.