Giter Club home page Giter Club logo

Comments (8)

mccxiv avatar mccxiv commented on April 28, 2024 2

@pauloevpr looks like the readme has a Typescript section now

https://github.com/vuejs/vue-function-api#typescript

from composition-api.

pauloevpr avatar pauloevpr commented on April 28, 2024 1

Great. I am happy now. Thanks.

from composition-api.

posva avatar posva commented on April 28, 2024

It works out of the box, pretty much everything is automatically or explicitly inferred because of how the api is designed. What were you expecting exactly?

from composition-api.

pauloevpr avatar pauloevpr commented on April 28, 2024

I was expecting to see Typescript-specific examples, such as the ones in the RFC using createComponent() and showing how type inference works with props.

Everyone who's been following the RFCs pretty much knows that the Function-API supports Typescript naturally. But it would be great to make things more explicit especially for developers getting started with the new API.

I really want this epic API to take off.

from composition-api.

posva avatar posva commented on April 28, 2024

Yeah, I think having docs in js makes it easy for both javascript and typescript developers to pick it up. Did you find any blocker when using typescript? Something that didn't work out of the box?

from composition-api.

pauloevpr avatar pauloevpr commented on April 28, 2024

Typescript only works properly for me when using createComponent.

image

image

from composition-api.

theWorkFsz avatar theWorkFsz commented on April 28, 2024

@pauloevpr you can use Vue.extend() to let TypeScript properly infer types inside Vue component options

https://vuejs.org/v2/guide/typescript.html#Basic-Usage

from composition-api.

pauloevpr avatar pauloevpr commented on April 28, 2024

I am not sure if I got your point. We are discussing about the new Function-API. According to the RFC:

"createComponent is conceptually similar to 2.x's Vue.extend, but it is a no-op and only needed for typing purposes."

So createComponent must be used instead of Vue.extend.

I opened this issue to report that the READ.me on this repo lacks Typescript examples. That is all.

from composition-api.

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.