Skip to content

Commit

Permalink
refactor(rax): migrate to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanmaisse committed Jan 6, 2021
1 parent 5898c07 commit a13af7b
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/rax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@types/rax": "^1.0.2",
"rax": "^1.1.0"
},
"peerDependencies": {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const {
} = clientApi;

const framework = 'rax';
export const storiesOf = (...args) => clientApi.storiesOf(...args).addParameters({ framework });
export const configure = (...args) => coreConfigure(framework, ...args);
export const storiesOf = (...args: any) =>
clientApi.storiesOf(...args).addParameters({ framework });
export const configure = (...args: any) => coreConfigure(framework, ...args);

export { forceReRender };
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export default function renderMain({
name,
showMain,
showError,
// forceRender,
}: {
storyFn: Function;
kind: string;
name: string;
showMain: () => any;
showError: (input: { title: string; description: string }) => void;
}) {
const Element = storyFn;

Expand All @@ -29,6 +34,11 @@ export default function renderMain({

showMain();

// There is something miscellaneous here, for now, more precisely on L23,
// as we are using the storyFn directly and not calling it, so `Element` is a
// function but according to `createElement` types, there is no signature
// taking a function as input.
// @ts-expect-error
render(createElement(Element), rootElement, {
driver: DriverDOM,
});
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function babelDefault(config) {
import { TransformOptions } from '@babel/core';

export function babelDefault(config: TransformOptions) {
return {
...config,
presets: [
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions app/rax/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare module '@storybook/core/*';
declare module 'global';
7 changes: 7 additions & 0 deletions app/rax/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"types": ["webpack-env", "node"]
}
}
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4986,6 +4986,14 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.3.tgz#7ee330ba7caafb98090bece86a5ee44115904c2c"
integrity sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==

"@types/rax@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@types/rax/-/rax-1.0.2.tgz#1a6121244a0ad31deecdcede2651efa4ec9ead2a"
integrity sha512-oB3tpuFhFc4osp2brErugGbInNQs15GSmE21PXh7LVMPwUaemBTMjzGxXrzgvoW/marD9sRxPJTkf53UJpjnnA==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/reach__router@^1.3.5":
version "1.3.6"
resolved "https://registry.yarnpkg.com/@types/reach__router/-/reach__router-1.3.6.tgz#413417ce74caab331c70ce6a03a4c825188e4709"
Expand Down

0 comments on commit a13af7b

Please sign in to comment.