forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefinitelyTyped#33052 from ZhangYiJiang/add-react-…
…kawaii [react-kawaii] Add react-kawaii typings
- Loading branch information
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
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,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>; |
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,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' }; |
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,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" | ||
] | ||
} |
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 @@ | ||
{ "extends": "dtslint/dt.json" } |