msgraph-sdk-javascript icon indicating copy to clipboard operation
msgraph-sdk-javascript copied to clipboard

v4 Discussion: Graph TS Typings with Graph Service library

Open nikithauc opened this issue 3 years ago • 5 comments

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.

nikithauc avatar Jan 24 '22 05:01 nikithauc

wouldn't the first one be?

const user: User = graphCoreClient.api("/user/1234") as User;

baywet avatar Jan 24 '22 19:01 baywet

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).

sebastienlevert avatar Jan 24 '22 19:01 sebastienlevert

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.

nikithauc avatar May 10 '22 22:05 nikithauc

and by models I'm assuming you're referring to the interfaces version in that case, not the classes, correct?

baywet avatar May 10 '22 22:05 baywet

Correct. Basically the data shape.

sebastienlevert avatar May 11 '22 16:05 sebastienlevert

Closing as planning for #979

nikithauc avatar Oct 26 '22 03:10 nikithauc