Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

feat: add typescript support #1

Merged
merged 3 commits into from
Oct 12, 2021
Merged

feat: add typescript support #1

merged 3 commits into from
Oct 12, 2021

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Oct 8, 2021

No description provided.

@yannbf yannbf requested a review from ghengeveld October 8, 2021 15:59
@shilman shilman added the enhancement New feature or request label Oct 11, 2021
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo formatting. merging this to get things unstuck.

src/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting the following errors when I run locally:

MMBP15:testing-library shilman$ yarn build
yarn run v1.22.11
$ tsc
node_modules/@storybook/addons/dist/ts3.9/types.d.ts:1:23 - error TS2688: Cannot find type definition file for 'webpack-env'.

1 /// <reference types="webpack-env" />
                        ~~~~~~~~~~~

src/index.ts:12:5 - error TS2345: Argument of type '{ intercept: (method: string, path: (string | CallRef)[]) => boolean; getArgs: (call: any, state: any) => any; }' is not assignable to parameter of type 'Options'.
  Object literal may only specify known properties, and 'getArgs' does not exist in type 'Options'.

 12     getArgs: (call, state) => {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 13       if (!state.isDebugging) return call.args
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
 26       return call.args
    ~~~~~~~~~~~~~~~~~~~~~~
 27     },
    ~~~~~

src/index.ts:12:15 - error TS7006: Parameter 'call' implicitly has an 'any' type.

12     getArgs: (call, state) => {
                 ~~~~

src/index.ts:12:21 - error TS7006: Parameter 'state' implicitly has an 'any' type.

12     getArgs: (call, state) => {

@yannbf
Copy link
Member Author

yannbf commented Oct 12, 2021

Getting the following errors when I run locally:

MMBP15:testing-library shilman$ yarn build
yarn run v1.22.11
$ tsc
node_modules/@storybook/addons/dist/ts3.9/types.d.ts:1:23 - error TS2688: Cannot find type definition file for 'webpack-env'.

1 /// <reference types="webpack-env" />
                        ~~~~~~~~~~~

src/index.ts:12:5 - error TS2345: Argument of type '{ intercept: (method: string, path: (string | CallRef)[]) => boolean; getArgs: (call: any, state: any) => any; }' is not assignable to parameter of type 'Options'.
  Object literal may only specify known properties, and 'getArgs' does not exist in type 'Options'.

 12     getArgs: (call, state) => {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 13       if (!state.isDebugging) return call.args
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
 26       return call.args
    ~~~~~~~~~~~~~~~~~~~~~~
 27     },
    ~~~~~

src/index.ts:12:15 - error TS7006: Parameter 'call' implicitly has an 'any' type.

12     getArgs: (call, state) => {
                 ~~~~

src/index.ts:12:21 - error TS7006: Parameter 'state' implicitly has an 'any' type.

12     getArgs: (call, state) => {

fixed!

@yannbf yannbf merged commit be954fb into main Oct 12, 2021
@ndelangen ndelangen deleted the feature/typescript-support branch October 12, 2021 13:27
@github-actions
Copy link

github-actions bot commented Feb 4, 2022

🚀 PR was released in v0.0.9 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants