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 14, 2020
1 parent 79346d2 commit bda6eb8
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
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 };
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.
@@ -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.
@@ -1,4 +1,4 @@
import packageJson from '../../package.json';
const packageJson = require('../../package.json');

export default {
packageJson,
Expand Down
2 changes: 2 additions & 0 deletions app/marko/src/typings.d.ts
@@ -0,0 +1,2 @@
declare module '@storybook/core/*';
declare module 'global';
7 changes: 7 additions & 0 deletions app/marko/tsconfig.json
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"types": ["webpack-env"]
}
}

0 comments on commit bda6eb8

Please sign in to comment.