Skip to content

Expose states from Stylable Typescript declaration file #2431

Open
@tzachbon

Description

@tzachbon

Actual Behavior

Today if users want to declare some type as a State from the stylesheet, they will have to do twice this since the states are private.

For example -

.root {
    -st-states: myState(enum(a, b));
}
import { st, classes } from './my-style.st.css';

 // have to redeclare the type
type States = 'a' | 'b';

const myState: States = 'a';

st(classes.root, { myState })

Expected Behavior

import { st, classes, states } from './my-style.st.css';

const myState: states['myState'] = 'a';

st(classes.root, { myState })

Version

4.12.0

Relevant log output

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew syntax feature or behaviorintegrationBundler, test-runner and node

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions