Coder Social home page Coder Social logo

New Design for Vue 3 JSX about babel-plugin-jsx HOT 3 CLOSED

vuejs avatar vuejs commented on July 19, 2024
New Design for Vue 3 JSX

from babel-plugin-jsx.

Comments (3)

tangjinzhou avatar tangjinzhou commented on July 19, 2024

ref vuejs/jsx-vue2#141

from babel-plugin-jsx.

wonderful-panda avatar wonderful-panda commented on July 19, 2024

About '.sync' modifier

In vue-next, we should use v-model instead of .sync modifier.

<MyComp v-model={[value, "foo"]} />

But I think this is not suitable for TSX in some points.

  1. TypeScript can't check type of value is assignable to foo or not.

  2. When foo is defined as required, TS2322 (Property 'foo' is missing in ...) will occur

I guess it is not impossible to solve them by changing type definitions, but it will makes type definitions too complex.

Simple solution is giving up v-model.

<MyComp foo={value} on={{ "update:foo": v => value = v }} />

Is there any other (more smart) solutions ?

from babel-plugin-jsx.

Amour1688 avatar Amour1688 commented on July 19, 2024
<MyComp foo={value} on={{ "update:foo": v => value = v }} />

Will you change type definitions when giving up v-model like above.

interface Props {
  foo?: string;
  on?: {
    'update:foo': (val: string) => void;
  }
}

Or

interface Props {
  vModel?: [string, 'foo']
}

But I think it will be a misunderstand because vModel is not a prop

from babel-plugin-jsx.

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.