diff --git a/app/rax/package.json b/app/rax/package.json index c5f0241e5db8..40aa3faec57d 100644 --- a/app/rax/package.json +++ b/app/rax/package.json @@ -54,6 +54,7 @@ "ts-dedent": "^2.0.0" }, "devDependencies": { + "@types/rax": "^1.0.2", "rax": "^1.1.0" }, "peerDependencies": { diff --git a/app/rax/src/client/index.js b/app/rax/src/client/index.ts similarity index 100% rename from app/rax/src/client/index.js rename to app/rax/src/client/index.ts diff --git a/app/rax/src/client/preview/globals.js b/app/rax/src/client/preview/globals.ts similarity index 100% rename from app/rax/src/client/preview/globals.js rename to app/rax/src/client/preview/globals.ts diff --git a/app/rax/src/client/preview/index.js b/app/rax/src/client/preview/index.ts similarity index 65% rename from app/rax/src/client/preview/index.js rename to app/rax/src/client/preview/index.ts index 109004a46b5f..488026ef4ff8 100644 --- a/app/rax/src/client/preview/index.js +++ b/app/rax/src/client/preview/index.ts @@ -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 }; diff --git a/app/rax/src/client/preview/render.js b/app/rax/src/client/preview/render.ts similarity index 80% rename from app/rax/src/client/preview/render.js rename to app/rax/src/client/preview/render.ts index fc1b4c93f8f7..15f3894268ce 100644 --- a/app/rax/src/client/preview/render.js +++ b/app/rax/src/client/preview/render.ts @@ -12,7 +12,13 @@ export default function renderMain({ name, showMain, showError, - // forceRender, +}: // forceRender, +{ + storyFn: Function; + kind: string; + name: string; + showMain: () => any; + showError: (input: { title: string; description: string }) => void; }) { const Element = storyFn; @@ -29,6 +35,7 @@ export default function renderMain({ showMain(); + // @ts-ignore render(createElement(Element), rootElement, { driver: DriverDOM, }); diff --git a/app/rax/src/server/build.js b/app/rax/src/server/build.ts similarity index 100% rename from app/rax/src/server/build.js rename to app/rax/src/server/build.ts diff --git a/app/rax/src/server/framework-preset-rax.js b/app/rax/src/server/framework-preset-rax.ts similarity index 66% rename from app/rax/src/server/framework-preset-rax.js rename to app/rax/src/server/framework-preset-rax.ts index 038cd57824b4..73fb93058e10 100644 --- a/app/rax/src/server/framework-preset-rax.js +++ b/app/rax/src/server/framework-preset-rax.ts @@ -1,4 +1,6 @@ -export function babelDefault(config) { +import { TransformOptions } from '@babel/core'; + +export function babelDefault(config: TransformOptions) { return { ...config, presets: [ diff --git a/app/rax/src/server/index.js b/app/rax/src/server/index.ts similarity index 100% rename from app/rax/src/server/index.js rename to app/rax/src/server/index.ts diff --git a/app/rax/src/server/options.js b/app/rax/src/server/options.ts similarity index 100% rename from app/rax/src/server/options.js rename to app/rax/src/server/options.ts diff --git a/app/rax/src/typings.d.ts b/app/rax/src/typings.d.ts new file mode 100644 index 000000000000..6288cba4b09a --- /dev/null +++ b/app/rax/src/typings.d.ts @@ -0,0 +1,2 @@ +declare module '@storybook/core/*'; +declare module 'global'; diff --git a/app/rax/tsconfig.json b/app/rax/tsconfig.json new file mode 100644 index 000000000000..0f41123e444a --- /dev/null +++ b/app/rax/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "types": ["webpack-env"] + } +} diff --git a/yarn.lock b/yarn.lock index 61d6524a6b97..405d34829a19 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4987,6 +4987,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"