Skip to content

Commit

Permalink
refactor(marko): migrate to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanmaisse committed Dec 16, 2020
1 parent 33a0c75 commit 46f5391
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 7 deletions.
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 = 'marko';
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 @@ -4,9 +4,9 @@ import dedent from 'ts-dedent';
import { logger } from '@storybook/client-logger';

const rootEl = document.getElementById('root');
let activeComponent = null; // currently loaded marko component.
let activeTemplate = null; // template for the currently loaded component.
let activeStoryFn = null; // used to determine if we've switched stories.
let activeComponent: any = null; // currently loaded marko component.
let activeTemplate: any = null; // template for the currently loaded component.
let activeStoryFn: any = null; // used to determine if we've switched stories.

export default function renderMain({
storyFn,
Expand All @@ -15,7 +15,14 @@ export default function renderMain({
showMain,
showError,
parameters,
// forceRender,
}: // forceRender,
{
storyFn: Function;
kind: string;
name: string;
showMain: () => any;
showError: (input: { title: string; description: string }) => void;
parameters: any;
}) {
const isSameStory = activeStoryFn === storyFn;
const config = storyFn();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function webpack(config) {
import { Configuration } from 'webpack';

export function webpack(config: Configuration) {
return {
...config,
module: {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions app/marko/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/marko/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"]
}
}

0 comments on commit 46f5391

Please sign in to comment.