GithubHelp home page GithubHelp logo

Comments (6)

Shyam-Chen avatar Shyam-Chen commented on June 25, 2024

https://vuejs.org/guide/typescript/composition-api#typing-component-props

from core.

52javascript avatar 52javascript commented on June 25, 2024

https://vuejs.org/guide/typescript/composition-api#typing-component-props

并没用,示例里是个interface, 而我这里是个class, 就是识别不出来

from core.

ChuTingzj avatar ChuTingzj commented on June 25, 2024

https://vuejs.org/guide/typescript/composition-api#typing-component-props

并没用,示例里是个interface, 而我这里是个class, 就是识别不出来

我好像没复现3.2、3.4都试过了,也有可能是IDE的问题

from core.

ChuTingzj avatar ChuTingzj commented on June 25, 2024

https://vuejs.org/guide/typescript/composition-api#typing-component-props

并没用,示例里是个interface, 而我这里是个class, 就是识别不出来

官方是这么说的

语法限制
在 3.2 及以下版本中,defineProps() 的泛型类型参数仅限于类型文字或对本地接口的引用。
这个限制在 3.3 中得到了解决。最新版本的 Vue 支持在类型参数位置引用导入和有限的复杂类型。但是,由于类型到运行时转换仍然基于 AST,一些需要实际类型分析的复杂类型,例如条件类型,还未支持。您可以使用条件类型来指定单个 prop 的类型,但不能用于整个 props 对象的类型。

from core.

52javascript avatar 52javascript commented on June 25, 2024

https://vuejs.org/guide/typescript/composition-api#typing-component-props

并没用,示例里是个interface, 而我这里是个class, 就是识别不出来

官方是这么说的

语法限制 在 3.2 及以下版本中,defineProps() 的泛型类型参数仅限于类型文字或对本地接口的引用。 这个限制在 3.3 中得到了解决。最新版本的 Vue 支持在类型参数位置引用导入和有限的复杂类型。但是,由于类型到运行时转换仍然基于 AST,一些需要实际类型分析的复杂类型,例如条件类型,还未支持。您可以使用条件类型来指定单个 prop 的类型,但不能用于整个 props 对象的类型。

你是通过use函数导出的class对象吗

from core.

ChuTingzj avatar ChuTingzj commented on June 25, 2024

https://vuejs.org/guide/typescript/composition-api#typing-component-props

并没用,示例里是个interface, 而我这里是个class, 就是识别不出来

官方是这么说的
语法限制 在 3.2 及以下版本中,defineProps() 的泛型类型参数仅限于类型文字或对本地接口的引用。 这个限制在 3.3 中得到了解决。最新版本的 Vue 支持在类型参数位置引用导入和有限的复杂类型。但是,由于类型到运行时转换仍然基于 AST,一些需要实际类型分析的复杂类型,例如条件类型,还未支持。您可以使用条件类型来指定单个 prop 的类型,但不能用于整个 props 对象的类型。

你是通过use函数导出的class对象吗

啥意思

from core.

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.