Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to define then consume types for a web-based API using Typescript

$
0
0

I am writing a web service and I want to build out types that can be used by the client which is another repository. So, if I have something like:

export interface Device {name: string,address: number}

And I return this "shape" in a json payload, but I'd like to share the type definition with the client, what is the best way to do that? Do I need to create a new repository and publish a d.ts file as an npm package, then import that from the client? Or is there a better way?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>