Comments (25)
BTW: could you work on the TS definition file. Not sure where to add it.
from storybook.
hello Tomitrescak , I never make PR before, I don't know how it works.
For the test , I think you have already tcheck it : http://definitelytyped.org/guides/contributing.html#tests
It's right, I never saw the npm module name like @username/module-npm-Name I think it's not very conventional.
Does you think rename it like it: https://www.npmjs/package/storybook after @arunoda ?
It will better for the future not for only this case.
from storybook.
Is this what you are after? @arunoda you can maybe add it? Or do you want a PR?
declare var module: any;
declare module "@kadira/storybook" {
interface Story {
add (storyName: string, callback: Function): Story;
}
export function storiesOf(name: string, module: any): Story;
export function action(name: string): void;
}
from storybook.
You also need to extend your definition of webpack.config.js to following. @arunoda, resolving jsx should be supported by default in my opinion.
const path = require('path');
module.exports = {
module: {
resolve: {
extensions: ['', '.js', '.jsx']
},
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
query: { presets: ['react', 'es2015', 'stage-2'] },
exclude: [path.resolve('./node_modules'), path.resolve(__dirname, 'node_modules')],
include: [path.resolve('./'), __dirname],
},
{
test: /\.css?$/,
loaders: [ 'style', 'raw' ],
include: path.resolve(__dirname, '../')
}
]
}
};
from storybook.
Hmm, resolving does not seem to work .. not sure why .. the jsx files are not resolved ;(
from storybook.
@tomitrescak I am not good with TS, yes send me a PR.
Also add .configure() method as a definition.
BTW, how TS and .jsx extentions are related?
from storybook.
tsx are compiled into jsx in some configurations (e.g. mine). I am not using typescript loaders or typescript compiler in Meteor, but am compiling TS files into JS. This is faster and more controllable.
from storybook.
Okay. got it.
I took the jsx PR and now in master.
Will do a release in few hours.
from storybook.
Thanks guys!
The best place for typescript definition is on the definitelytyped site.
http://definitelytyped.org/
it's a catalogue for typescript definition.
from storybook.
@Gi972 I submitted a pull request, yet they need to include a test file with it as well. And I have noo idea what to put in those tests. Have you done a PR there before?
I also have a full d.t.s definition for Mantra ready, which I'm using personally and I can share it .. yet again .. no idea what tests should be there.
from storybook.
Another problem is that storybook does not have a npmjs page, therefore it is not recognised by the DT CI workflow.
from storybook.
We have a NPM page.
See: https://www.npmjs.com/package/@kadira/storybook/
from storybook.
Yea, I know, but the silly CI scrip only check for high level npmjs addresses such as https://www.npmjs.com/package/storybook/
from storybook.
@Gi972 yes it not. That's something NPM introduce recently. This is very important because of the recent NPM related issues.
If that user have used a scoped package, there may not such an issue.
from storybook.
Definitely Typed is deprecated in favour of https://github.com/typings/typings. It's much easier to add to.
from storybook.
Great catch! I'll add it as soon as I'll have a bit of time.
from storybook.
@camwest I simply do not have the time. Yet, @arunoda, if you make the typings part of your package (above), it can be easily added to the typings repository.
from storybook.
@tomitrescak You mean, use typescript?
from storybook.
No, making the typescript definition as a part of the package and including it in package.json:
// file lib/typings.d.ts
declare var module: any;
declare module "@kadira/storybook" {
interface Story {
add (storyName: string, callback: Function): Story;
}
export function storiesOf(name: string, module: any): Story;
export function action(name: string): void;
}
and in package.json
"typings": "./lib/typings.d.ts"
More info ... http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html
Do you want a PR for this?
from storybook.
@tomitrescak Why not. Send me a PR.
from storybook.
@tomitrescak This is merged and released with v1.20.0
. What else do we need to have to do?
from storybook.
All you need to do is enjoy the smiles of Typescript developers that will love you for this;) and occasionally update the typing when API changes. If you'll need help, just ping me. Thanks!
from storybook.
And you can close this now. Thanks!
from storybook.
Thanks @tomitrescak.
I think I can update the def file with API changes :)
from storybook.
@tomitrescak @arunoda
Guys thanks a lot for your time
;-)
from storybook.
Related Issues (20)
- [Tracking] Module mocking in storybook
- [Bug]: Cannot read properties of undefined (reading 'every') when using essentials addon with typescript HOT 2
- [Documentation]: IS_STORYBOOK env variable is not defined anymore HOT 1
- [Bug]: accidentally ending a title with a `/` breaks storybook HOT 2
- [Bug]: Ember with Storybook 8 doesn't work
- [Bug]: ExceedsStorageRange errors + sloooow experience with Storybook 8 + NextJS HOT 3
- [Tracking]: Save from Controls
- [Bug]: Javascript heap out of memory when doing build-storybook when using docgen: 'vue-component-meta' HOT 1
- [Bug]: react-docgen fails on match(regex) inside promise. HOT 3
- [Bug]: Source maps fail to load with "Unsupported URL scheme" HOT 2
- [Bug]: Error in component stories using Drawer component in MUI HOT 8
- [Project SfC]: Create a server channel API to edit the args of a story or to create a new story
- [Project SfC]: Create a server channel API to create new story files triggered by the manager UI
- [Project SfC]: Provide a server channel API to get a list of files on the filesystem
- [Project SfC]: Create a toolbar to save arguments for existing or new stories
- While hitting tab key from the "skip to sidebar" button the keyboard focus is landing on the entire default page.
- [Bug]: Next JS addon shows errors using compiled .js instead of original .ts HOT 2
- Automigration for adding VTA on upgrade HOT 3
- Screen reader is not announcing the selection state of the "Violations"/"Passes"/"Incomplete" tab items in Accessibility Tab.
- Unable to use `Canvas` in doc-only MDX after upgrading to Storybook 8 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook.