mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add react-kawaii typings
This commit is contained in:
parent
93ed5c2843
commit
08c29b69ff
33
types/react-kawaii/index.d.ts
vendored
Normal file
33
types/react-kawaii/index.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Type definitions for react-kawaii 0.11
|
||||
// Project: https://github.com/miukimiu/react-kawaii
|
||||
// Definitions by: Zhang Yi Jiang <https://github.com/ZhangYiJiang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export type KawaiiMood =
|
||||
| 'sad'
|
||||
| 'shocked'
|
||||
| 'happy'
|
||||
| 'blissful'
|
||||
| 'lovestruck'
|
||||
| 'excited'
|
||||
| 'ko';
|
||||
|
||||
export interface KawaiiProps {
|
||||
size?: number;
|
||||
color?: string;
|
||||
mood?: KawaiiMood;
|
||||
}
|
||||
|
||||
export const SpeechBubble: React.ComponentType<KawaiiProps>;
|
||||
export const Mug: React.ComponentType<KawaiiProps>;
|
||||
export const Browser: React.ComponentType<KawaiiProps>;
|
||||
export const Ghost: React.ComponentType<KawaiiProps>;
|
||||
export const Cat: React.ComponentType<KawaiiProps>;
|
||||
export const IceCream: React.ComponentType<KawaiiProps>;
|
||||
export const CreditCard: React.ComponentType<KawaiiProps>;
|
||||
export const File: React.ComponentType<KawaiiProps>;
|
||||
export const Backpack: React.ComponentType<KawaiiProps>;
|
||||
export const Planet: React.ComponentType<KawaiiProps>;
|
||||
22
types/react-kawaii/react-kawaii-tests.tsx
Normal file
22
types/react-kawaii/react-kawaii-tests.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import { Cat, Planet, Mug, Browser, Backpack, Ghost, File, SpeechBubble, KawaiiMood, KawaiiProps, IceCream } from 'react-kawaii';
|
||||
|
||||
const PlanetExample = () => <Planet size={200} mood="blissful" color="#FDA7DC" />;
|
||||
const MugExample = () => <Mug size={200} mood="ko" color="rebeccapurple" />;
|
||||
const GhostExample = () => <Ghost size={200} mood="lovestruck" color="#E0E4E8" />;
|
||||
const FileExample = () => <File size={200} mood="blissful" color="#83D1FB" />;
|
||||
const IceCreamExample = () => <IceCream mood="happy" />;
|
||||
const BrowserExample = () => <Browser size={500} />;
|
||||
const BackpackExample = () => <Backpack />;
|
||||
const SpeechBubbleExample = () => <SpeechBubble />;
|
||||
const CatExample = () => <Cat />;
|
||||
|
||||
// $ExpectError
|
||||
const invalidMoodNumber: KawaiiMood = 5;
|
||||
|
||||
// $ExpectError
|
||||
const invalidMoodString: KawaiiMood = '';
|
||||
|
||||
// This is defined on one line to avoid the position of the error moving between TS2/3
|
||||
// $ExpectError
|
||||
const invalidProps: KawaiiProps = { size: '200px' };
|
||||
24
types/react-kawaii/tsconfig.json
Normal file
24
types/react-kawaii/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"jsx": "react",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-kawaii-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-kawaii/tslint.json
Normal file
1
types/react-kawaii/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user