v4 Discussion: Graph TS Typings with Graph Service library
Opening this issue to record the recent conversations on:
TS models will be used by a core and a service library user
Following are the possible use cases:
const user: User = graphCoreClient.api("/user/1234");
const user: User = graphServiceClient.user.get("1234");
The typings should be designed and shipped considering the use cases above.
wouldn't the first one be?
const user: User = graphCoreClient.api("/user/1234") as User;
Absolutely agree here. The same typings should be used by a user leveraging Core and the Service Library. This means it should be delivered via its own package for users to also benefit from the latest models of Microsoft Graph API (generated in sync with the service library that would take a dependency on the generated typings package).
Had a discussion with @ddyett about this topic. His idea is that Kiota generation should be able to generate only models which we continue packaging and shipping as just types like we do currently.
Generating models/types and publishing in Definitely Typed is an example I can think of where generating only models will be useful.
and by models I'm assuming you're referring to the interfaces version in that case, not the classes, correct?
Correct. Basically the data shape.
Closing as planning for #979