TypeScript Notebook for VS Code
vscode-typescript-notebook is a focused VS Code notebook frontend for TypeScript runtimes that speak the Jupyter messaging protocol.
It is intentionally narrower than the Microsoft Jupyter extension:
- native
.tsnb and .ts.ipynb notebooks;
- TypeScript and Markdown cells;
- Jupyter kernels whose kernelspec language is
typescript;
- local notebook execution, outputs, restart, and interrupt;
- in-memory cross-cell TypeScript analysis;
- no dependency on
ms-toolsai.jupyter.
Getting started
- Install TypeScript Notebook in desktop VS Code and install a local Jupyter kernelspec whose
language is typescript (for example, an Affon TypeScript kernel).
- Open or create a
.tsnb or .ts.ipynb notebook. Choose TypeScript Notebook through Reopen Editor With if another notebook editor opens it.
- Select the TypeScript kernel from the notebook kernel picker, then run a code cell.
The extension runs local kernels and requires a trusted workspace. Release packages target each supported desktop platform. Remote kernels, web VS Code, widgets, and debugging are outside the current feature set. See the kernel and editor details below before using notebooks from another Jupyter frontend.
Report problems through GitHub Issues. Include your VS Code version, operating system, kernelspec language, and the TypeScript Notebook output channel log.
Both suffixes use the same standard Jupyter nbformat 4 JSON and the same serializer. Rename between .tsnb and .ts.ipynb without conversion. Use .ts.ipynb for GitHub notebook rendering, or .tsnb for a shorter filename.
The original experimental { "format": 1 } schema is no longer supported; .tsnb files must also contain standard Jupyter JSON.
With Microsoft Jupyter installed, use Reopen Editor With → TypeScript Notebook if VS Code selects Jupyter. To persist that choice, add this entry to your existing workbench.editorAssociations setting:
{
"workbench.editorAssociations": {
"*.tsnb": "typescript-notebook",
"*.ts.ipynb": "typescript-notebook"
}
}
Ordinary .ipynb files are unaffected by this association. No Linguist override or generated notebook copies are required.
The frontend is runtime-neutral. Affon is one supported runtime, but any compatible TypeScript Jupyter kernel can be selected and used.
Kernel and editor details
The kernel picker lists local Jupyter kernelspecs whose language is typescript,
using their display names (for example, Affon (TypeScript)). Choose an entry
to run that runtime. The typescriptNotebook.kernelName setting recommends a
default; an explicit picker choice takes precedence. Switching kernels stops
the old session, and restart retains the selected runtime. Reload the window
after installing a new kernelspec. If none are found, install a TypeScript
kernelspec first; no placeholder execution controller is registered.
Saved notebooks start their kernel in the notebook's directory, so relative
dataset and file paths resolve beside the notebook. Unsaved notebooks use an
available workspace folder, falling back to the extension host's directory.
Restart the kernel after moving or saving a notebook into a different directory.
The TypeScript Notebook output channel logs the chosen kernel and working directory.
Interrupt uses the kernel's declared interrupt_mode. Kernels using message receive an interrupt request on the Jupyter control channel. Kernels using signal receive SIGINT on macOS and Linux. On Windows, signal based kernels are stopped and start again on the next execution because Node cannot deliver a graceful signal to the child process.
Notebook type checking uses the nearest tsconfig.json, including its lib,
types, typeRoots, and paths settings. TypeScript's standard declaration
files are included in the extension. Runtime declarations still come from the
project: Affon's repository supplies them through packages/@types.
Code cells display TypeScript, but internally use ts-notebook.typescript
so our cross-cell language service does not compete with the built-in TypeScript
service. No setup is required, and ordinary .ts files are unaffected. Syntax
highlighting reuses VS Code's TypeScript grammar; notebook metadata still saves
the standard typescript language for other Jupyter frontends. Third-party
formatters, snippets, and language-specific settings targeting only typescript
do not automatically apply to these cells; integrations must also support
ts-notebook.typescript.
Inlay hints use our cross-cell analysis and honor js/ts.inlayHints.*
settings, including [typescript] overrides, with legacy typescript.inlayHints.*
fallbacks. Explicit unified settings take precedence. Enable inferred variable types
with "js/ts.inlayHints.variableTypes.enabled": true. Editor-level hint
visibility follows editor.inlayHints.enabled for ts-notebook.typescript;
an editor setting under [typescript] alone does not apply to notebook cells.
Development
npm ci
npm test
npm run test:kernel
npm run package
npm run package:darwin-arm64
npm run package:darwin-x64
npm run package:win32-x64
npm run package:win32-arm64
npm run package:linux-x64
npm run package:linux-arm64
License
This Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain
one at https://mozilla.org/MPL/2.0/. See LICENSE.
Dependency licenses are listed in THIRD_PARTY_NOTICES.md.
The VSIX includes this extension's source under src/.