cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.08k stars 399 forks source link

type Plugin should be JSPlugin #1166

Closed jacobbogers closed 5 years ago

jacobbogers commented 5 years ago

(Edited I provided more info) (edited) Should be JSSPlugin (edited) corrected for versions, the jss plugin used, the jss, and the @types/jss

jss-plugin-camel-case

Used npm i --save jss-plugin-camel-case to install it, no explicit version specified Looking in the node_modules it installs version "10.0.0-alpha.7"

The typescript index.d.ts of the jss-plugin-camel-case

import {Plugin} from 'jss'

export default function jssPluginSyntaxNested(): Plugin

Versions (please complete the following information):

HenriBeck commented 5 years ago

Why would this need to be JSPlugin? we don't even have such a type. Also, alpha 7 is outdated, please upgrade to the latest alpha and check if your problem still exists.

jacobbogers commented 5 years ago

In typescript I am using the @types/jss with version "9.5.8"
I simple installed with npm i --save-dev @types/jss if this outdated can you update the npm registry to the most current one

in the index.d.ts is shows `export function create(options?: Partial): JSS;``

and if you look up JSSOptions it shows

export interface JSSOptions {
    createGenerateClassName(): GenerateClassName;
    plugins: ReadonlyArray<JSSPlugin>;  // <--- JSSPlugin not Plugin
    virtual: boolean;
    insertionPoint: string | HTMLElement;
}
HenriBeck commented 5 years ago

Yeah, so that's your problem. @types/jss is incompatible with jss v10. In v10 we moved the types so you don't need @types/jss anymore.

jacobbogers commented 5 years ago

Oh while you replied , I adjusted my original message)) I am not using explicit version numbers during npm i, Is it possible for you to have the npm fetch the the correct one where everything is consistent

HenriBeck commented 5 years ago

Just do npm install jss@next and remove the @types/jss dependency

jacobbogers commented 5 years ago

Ok

jacobbogers commented 5 years ago

Also for the plugins?

HenriBeck commented 5 years ago

yes

jacobbogers commented 5 years ago

Ok, works

I also noticed the new jss.create({ plugins }) needs an array of type plugins instead of functions creating plugins (options:Options) => Plugin