GithubHelp home page GithubHelp logo

ybiquitous / bem-ts Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 1.0 6.96 MB

BEM class names generator for TypeScript

Home Page: https://npm.im/bem-ts

License: MIT License

TypeScript 94.12% JavaScript 5.88%
bem classnames typescript utility

bem-ts's Introduction

Hi, I’m Masafumi Koba (ybiquitous) 👋

I’m a programmer loving Web, JavaScript, CSS, Ruby, and Emacs!

Masafumi Koba’s GitHub stats

Masafumi Koba’s Top Langs

bem-ts's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar github-actions[bot] avatar mergify[bot] avatar renovate[bot] avatar weaintplastic avatar ybiquitous avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

weaintplastic

bem-ts's Issues

Example does not work

In the README is this example:

import * as React from "react";
import bem from "bem-ts";
import "./Button.scss";

const b = bem("Button");

interface Props {
  state: "success" | "danger";
  icon: React.ReactNode;
  children: React.ReactNode;
}

export function Button({ state, icon, children }: Props) {
  return (
    <button className={b({ state })}>
      <i className={b("icon", { state })}>{icon}</i>
      {children}
    </button>
  );
}

But it produces type conflicts:

Argument of type '{ state: "success" | "danger"; }' is not assignable to parameter of type 'string | Modifiers | undefined'.
  Types of property 'state' are incompatible.
    Type '"success" | "danger"' is not assignable to type 'boolean | null | undefined'.
      Type '"success"' is not assignable to type 'boolean | null | undefined'.

Could not find module in path: 'bem-ts'

When upgrading from 0.12.1 to 0.13.x typscript is complaining about the missing module bem-ts

ModuleNotFoundError: Could not find module in path: 'bem-ts' relative to '/src/index.ts'

I've created a code sandbox to demonstrate the issue running the following code

import bem from "bem-ts";

const b = bem("block");

console.log(b());

bem-ts v0.12.1: https://codesandbox.io/s/typescript-forked-959orq?file=/src/index.ts
bem-ts v0.13.0: https://codesandbox.io/s/typescript-forked-slo8ef?file=/src/index.ts

I hope the description makes sense and you can follow my lead. Happy to support fixing this bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.