Skip to content

Question: Usage for generating types for variables (e.g. a "variables.scss")Β #216

@fullyherge

Description

@fullyherge

We have a maybe irrelevant for this package use case in which we mostly want to generate type definitions for our variables.

For example we would like this .scss:

$screen-size-keys: ("xxs", "xs", "sm", "md", "lg", "xl", "xxl");
$screen-size-map: (
  "xxs": 280px,
  "xs": 320px,
  "sm": 576px,
  "md": 768px,
  "lg": 992px,
  "xl": 1200px,
  "xxl": 1400px,
);

to generate something like this .d.ts

type ScreenSizeKeys = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
type ScreenSizeMap = {
  [key: string]: string // or if I may dream ` { [key in ScreenSizeKeys]: string } `
};

Is this completely out of the scope of this package? If no, how would I accomplish this? If yes, does anyone know any library for doing something like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions