Repository navigation
Add @types/jss - #21851
Add @types/jss#21851
Conversation
|
types/dvtng__jss/index.d.ts Checklist
types/jss/index.d.ts to author (@Ptival). Could you review this PR? |
|
cc @kof |
|
@appsforartists Please fix the failures indicated in the Travis CI log. |
|
I don't understand. https://travis-ci.org/DefinitelyTyped/DefinitelyTyped/builds/309288324 says I need to rename the old tests to |
|
@kof, thanks for your comments. I deleted the internal-only types. Not sure what to do about the |
|
I thinnk that would be fine,considered we didn't have any typings for ts at all. |
|
Actually I should have added flow types only to public API, that way it would be easier for everyone. |
|
Thorough types hopefully helps you catch implementation problems on your end, and might make some types more specific for downstream authors (like knowing which kind of |
|
@kof - I just pushed a new revision, that includes types for (nearly) everything documented at http://cssinjs.org/js-api?v=v9.3.3. For the record, he and I had a long chat inline at appsforartists@47e2432 regarding how to handle |
| @@ -0,0 +1,16 @@ | |||
|
|
|||
|
|
|||
| jss.set('.demo', { | |||
There was a problem hiding this comment.
where does this come from? doesn't look like the right interface 😄
There was a problem hiding this comment.
Oh this comes from a different project, from Box9/jss
There was a problem hiding this comment.
Yeah, somebody was squatting on @types/jss, so I had to move it before I could write these.
There was a problem hiding this comment.
foo__bar is the style for scoped packages e.g. @dvtng/jss on npm. We don't really have a style for things not published to npm; I would just call this dvtng-jss.
| /** | ||
| * Link renderable CSS rules from sheet with their corresponding models. | ||
| */ | ||
| link(): this; |
There was a problem hiding this comment.
I consider this one to be a private method
There was a problem hiding this comment.
Removed. indexOf doesn't appear to be documented either, but I left it since index is.
| onProcessRule(rule: Rule, sheet: StyleSheet<any>): void, | ||
| onProcessStyle(style: Style, rule: Rule, sheet: StyleSheet<any>): Style, | ||
| onProcessSheet(sheet: StyleSheet<any>): void, | ||
| onChangeValue(value: any, prop: string, rule: Rule): any, |
There was a problem hiding this comment.
There is one more: onUpdate(data, rule, sheet)
There was a problem hiding this comment.
|
Ok, couldn't find anything else. |
|
Yep, we added docs for it just recently, it was "internal" before, will publish soon. Also missed in flow types. |
|
Ahhh - I couldn't find it in the codebase because I had 9.2 checked out. Updated. |
|
@Andy-MS Travis keeps telling me the build failed because the tests file for |
| /** | ||
| * Get a rule by name. | ||
| */ | ||
| getRule(name: keyof T | string): Rule; |
| * Update the function values with a new data. | ||
| */ | ||
| update(data?: {}): this; | ||
| update(name?: string, data?: {}): this; |
There was a problem hiding this comment.
These parameters don't need to be optional since the ability to pass 0 or 1 arguments is handled by the first overload
| * Creates a new instance of JSS. | ||
| */ | ||
| export function create(options?: Partial<JSSOptions>): JSS; | ||
| /** |
There was a problem hiding this comment.
The comment says you're exporting an instance, but this exports the class.
| ).attach(); | ||
|
|
||
| // test that `classes` has strings for each key in the `styles` argument | ||
| styleSheet.classes.container.toUpperCase(); |
There was a problem hiding this comment.
You could use // $ExpectType string instead.
| @@ -0,0 +1,16 @@ | |||
|
|
|||
|
|
|||
| jss.set('.demo', { | |||
There was a problem hiding this comment.
foo__bar is the style for scoped packages e.g. @dvtng/jss on npm. We don't really have a style for things not published to npm; I would just call this dvtng-jss.
|
@appsforartists It gets the files list from |
Fixes DefinitelyTyped#19974 The type definitions in `@types/jss` don't match the `jss` package on npm, which has nearly 400k monthly downloads. I'm not sure where to put the definitions currently squatting at `jss`, as it [doesn't appear that](https://www.npmjs.com/~dvtng) @dvtng has published them.
Use a meaningful title for the pull request. Include the name of the package modified.
Test the change in your own code. (Compile and run.)
Follow the advice from the readme.
Avoid common mistakes.
Run
npm run lint package-name(ortscif notslint.jsonis present).The package does not provide its own types, and you can not add them.
If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
Create it with
dts-gen --dt, not by basing it on an existing project.tslint.jsonshould be present, andtsconfig.jsonshould havenoImplicitAny,noImplicitThis,strictNullChecks, andstrictFunctionTypesset totrue.