Giter VIP home page Giter VIP logo

Comments (3)

brillout avatar brillout commented on May 28, 2024

An easy workaround would be that we write the d.ts ourselves, instead of using the generated one.

from vike-vue.

4350pChris avatar 4350pChris commented on May 28, 2024

An easy workaround would be that we write the d.ts ourselves, instead of using the generated one.

Could you elaborate?

My thinking was doing something along these lines

ClientOnly.vue

<script lang="ts" setup generic="T">
  type Props = {
     load: T
  }

  type ForwardProps = Awaited<ReturnValue<T>>["props"] // this isn't correct, I don't know how to get the props of the loaded component as of now

  defineProps<Props & ForwardProps>()
</script>

The main problem here is that we have a dynamic import, so I don't think I can just use the return value here. I have yet to try this out though.

from vike-vue.

brillout avatar brillout commented on May 28, 2024

I don't know much about Vue's TypeScript support but, in principle, if we manually create the .d.ts file for ClientOnly ourselfes then that should work (assuming SFC's TypeScript support is "lossless").

I guess the question boils down to that: can we make it work when the user doesn't use SFC? If yes and if SFC TypeScript is lossless, then we're good.

from vike-vue.

Related Issues (14)

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.