-
Notifications
You must be signed in to change notification settings - Fork 24
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 #5 from rangle/enable-ts
enable typescript in project
- Loading branch information
Showing
8 changed files
with
1,991 additions
and
67 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 |
---|---|---|
@@ -1,4 +1,24 @@ | ||
module.exports = { | ||
stories: ['../src/components/**/*.stories.js'], | ||
stories: ['../src/**/*.stories.(js|tsx)'], | ||
addons: ['@storybook/addon-actions', '@storybook/addon-links'], | ||
|
||
/** | ||
* todo: once https://github.com/storybookjs/presets/pull/83 is merged in, we may no longer need | ||
* to do this manually and simply just use the preset | ||
*/ | ||
webpackFinal: async config => { | ||
config.module.rules.push({ | ||
test: /\.(ts|tsx)$/, | ||
use: [ | ||
{ | ||
loader: require.resolve('ts-loader'), | ||
}, | ||
{ | ||
loader: require.resolve('react-docgen-typescript-loader'), | ||
}, | ||
], | ||
}); | ||
config.resolve.extensions.push('.ts', '.tsx'); | ||
return config; | ||
}, | ||
}; |
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 was deleted.
Oops, something went wrong.
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,11 @@ | ||
import * as React from "react"; | ||
import MySillyButton from "./button"; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
export default { | ||
title: 'MySillyButton', | ||
component: MySillyButton, | ||
}; | ||
|
||
export const example = () => <MySillyButton onClick={action('clicked')} /> | ||
|
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,8 @@ | ||
import * as React from "react"; | ||
|
||
interface MySillyButton { | ||
onClick: any | ||
} | ||
const MySillyButton = ({ onClick }: MySillyButton) => <button onClick={onClick}>hehe</button>; | ||
|
||
export default MySillyButton; |
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,28 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "build/lib", | ||
"module": "commonjs", | ||
"target": "es5", | ||
"lib": ["es5", "es6", "es7", "es2017", "dom"], | ||
"sourceMap": true, | ||
"allowJs": false, | ||
"jsx": "react", | ||
"moduleResolution": "node", | ||
"rootDirs": ["src"], | ||
"baseUrl": "src", | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"noUnusedLocals": true, | ||
"declaration": true, | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true | ||
}, | ||
"include": ["./src"], | ||
"exclude": ["node_modules", "build", "scripts"] | ||
} |