Code Monkey home page Code Monkey logo

Comments (7)

0xkee avatar 0xkee commented on August 11, 2024

类型是可以通过 ts 类型合并实现自定义:

declare module '@fower/atomic-props' {
  export interface AtomicProps {
    customProp?: string
  }
}

没理解 【是不是可以把生成types放在用户端, 可以根据不同的config生成不同的类型定义文件】这是什么意思

from fower.

bingtsingw avatar bingtsingw commented on August 11, 2024

合并类型只能增加, 不能减少, 如果color只定义了两个, 比如500和600, 还是会得到所有内置color的提示

from fower.

bingtsingw avatar bingtsingw commented on August 11, 2024

没理解 【是不是可以把生成types放在用户端, 可以根据不同的config生成不同的类型定义文件】这是什么意思

就是可以读取用户的config, 然后动态生成类型定义文件, 可以办到吗

from fower.

0xkee avatar 0xkee commented on August 11, 2024

fower 暂时没配置文件,配置通过 setConfig 实现,暂时不想引进配置文件的概念,因为那需要约定文件名和路径

from fower.

bingtsingw avatar bingtsingw commented on August 11, 2024

我说的就是setConfig, 不知道是否可以在setConfig里面加个generateTypes的钩子

from fower.

0xkee avatar 0xkee commented on August 11, 2024

这个也许可以,不过 setConfig 是项目运行时,不是 build 运行时,可能不好搞

from fower.

bingtsingw avatar bingtsingw commented on August 11, 2024

我想到的是用一个单独的包来实现生成逻辑, setConfig里可以判断环境变量和包是否存在来开关生成的逻辑.
当然这个包可以不依赖setConfig, 比如cli执行读取某个config文件, 生成类型

from fower.

Related Issues (20)

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.