Nbformat Typescript type definitions


For a notebook converter we are developing (more in a separate post), we’ve generated Typescript type definitions for nbformat JSON Schema versions 3 and 4 using json-schema-to-typescript e.g.

Previously we were using the type definitions already available in @jupyterlab/coreutils:

However, we found we had to use a couple of workarounds because those manually coded definitions differ from the JSON schema in some places (e.g. orig_nbformat is required) and due to the dependence on @phosphor/coreutils (which I can’t recall the details of). Also we wanted to have Typescript definitions for v3 which do not appear to be available anywhere else.

In our use case, we are using the nbformat JSON Schema definitions anyway (to validate both incoming notebooks prior to decoding, and outgoing notebooks after encoding). So, it makes sense to use Typescript definitions generated from those schemas. We have used json-schema-to-typescript elsewhere and have been pleased with the type definitions it produces.

I was wondering if there is any interest in making these Typescript type definitions more generally available by submitting them to definitelytyped\.org. They would then be available via npm install @types/jupyter or similar. I’d be happy to help out with, or lead, a PR towards that, but also understand if someone else more involved in Jupyter development would prefer to take it over.

Cheers, Nokome

[Some links removed / escaped because new users only get to use 2 links per post :slight_smile: ]