Giter Site home page Giter Site logo

Comments (8)

mrlubos avatar mrlubos commented on May 25, 2024 1

@Darhagonable Done! For now I literally export the types that were there, maybe in the future it would make more sense to organise them into a separate types folder

from openapi-ts.

mrlubos avatar mrlubos commented on May 25, 2024 1

That sounds right. Honestly, you might be the only person using those types right now, since in the past you couldn't get to them in any other way than ReturnType<typeof DefaultService.foo> which is why I started using that. Of course, there might be times when you don't want to pull in the service import to your file. We could make the types exported too as you wrote above, but the more you export the more likelihood there will be a naming conflict, and we currently don't have a good way to detect and correct those. Also, this tree structure is a setup for #28. Once that is resolved, maybe we can clean it up a bit

from openapi-ts.

mrlubos avatar mrlubos commented on May 25, 2024

You can access them via Parameters<typeof MyService.operationName>[0] I believe, does that work for you?

from openapi-ts.

Darhagonable avatar Darhagonable commented on May 25, 2024

Thats what im currently doing. It works but is more verbose. Exporting those types would be a nice to have though :P

from openapi-ts.

Darhagonable avatar Darhagonable commented on May 25, 2024

@mrlubos types like this no longer seem to be exported or am i missing some migration step at some point?

from openapi-ts.

mrlubos avatar mrlubos commented on May 25, 2024

Are you able to import $OpenApiTs from types.gen? Just be warned this API isn't finalised yet and may change. I personally tend to use service classes to get to response or payload types - ReturnType<typeof DefaultService.foo>

from openapi-ts.

Darhagonable avatar Darhagonable commented on May 25, 2024

@mrlubos Yes i can import $OpenApiTs.
So if I'm understanding correctly TDataGetApiV1Foo has been changed to $OpenApiTs["/api/v1/foo"]["get"]["req"]?
Should probably be added to the migrations docs.

Seems then that the verbose ReturnType useage is the preferred option indeed.

from openapi-ts.

Darhagonable avatar Darhagonable commented on May 25, 2024

For now then ill do my own exports export type TDataGetApiV1Foo = ReturnType<typeof DefaultService.foo> 👍

from openapi-ts.

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.