Skip to content

Commit

Permalink
Merge pull request #5 from rangle/enable-ts
Browse files Browse the repository at this point in the history
enable typescript in project
  • Loading branch information
alaboudi authored Jan 23, 2020
2 parents 57b7081 + 27edc0f commit 40190fd
Show file tree
Hide file tree
Showing 8 changed files with 1,991 additions and 67 deletions.
22 changes: 21 additions & 1 deletion packages/ds-seed/.storybook/main.js
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;
},
};
7 changes: 6 additions & 1 deletion packages/ds-seed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
"@storybook/addon-links": "^5.3.8",
"@storybook/addons": "^5.3.8",
"@storybook/react": "^5.3.8",
"babel-loader": "^8.0.6"
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"babel-loader": "^8.0.6",
"react-docgen-typescript-loader": "^3.6.0",
"ts-loader": "^6.2.1",
"typescript": "^3.7.5"
},
"scripts": {
"storybook": "start-storybook -p 6006",
Expand Down
Empty file.
18 changes: 0 additions & 18 deletions packages/ds-seed/src/components/button.stories.js

This file was deleted.

11 changes: 11 additions & 0 deletions packages/ds-seed/src/components/button.stories.tsx
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')} />

8 changes: 8 additions & 0 deletions packages/ds-seed/src/components/button.tsx
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;
28 changes: 28 additions & 0 deletions packages/ds-seed/tsconfig.json
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"]
}
1,964 changes: 1,917 additions & 47 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 40190fd

Please sign in to comment.