Skip to content

Commit

Permalink
fix: Add type definition for blocks.js (on root)
Browse files Browse the repository at this point in the history
<#156>

`storybook-addon-designs/blocks` was missing `.d.ts` file, so importing
the file caused a type error.

```
Cannot find module 'storybook-addon-designs/blocks' or its corresponding type declarations.
```

fix #156
  • Loading branch information
pocka committed Jun 13, 2022
1 parent e9126f0 commit 4bf0125
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Export panel name as `PanelName`. ([851b486](https://github.com/pocka/storybook-addon-designs/commit/851b486543475384173532be27702e6a776b827d))

### Fixed

- Add type definition file for `storybook-addon-designs/blocks`.

## [6.2.1] - 2022-01-06

### Fixed
Expand Down
5 changes: 4 additions & 1 deletion packages/examples/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const tsconfig = path.resolve(
const addonPath = path.resolve(__dirname, '../../storybook-addon-designs')

module.exports = {
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.{js,jsx}'],
stories: [
'../stories/**/*.stories.mdx',
'../stories/**/*.stories.{js,jsx,ts,tsx}',
],
addons: [
'storybook-addon-designs',
'@storybook/addon-docs',
Expand Down
22 changes: 22 additions & 0 deletions packages/examples/stories/tests/issues/156.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react'
import { Figma } from 'storybook-addon-designs/blocks'

export default {
title: 'Tests/Issues/#156',
parameters: {
docs: {
page: () => (
<div>
<a href="https://github.com/pocka/storybook-addon-designs/discussions/155">
Original discussion
</a>
<Figma url="https://www.figma.com/file/Klm6pxIZSaJFiOMX5FpTul9F/storybook-addon-designs-sample" />
</div>
),
},
},
}

const Template = () => <button>Button</button>

export const dummy = Template.bind({})
8 changes: 8 additions & 0 deletions packages/examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"jsx": "react",
"esModuleInterop": true,
"strict": true,
"allowJs": false
}
}
1 change: 1 addition & 0 deletions packages/storybook-addon-designs/blocks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './esm/blocks'

0 comments on commit 4bf0125

Please sign in to comment.