Add "Typings" file to NPM package for Typescript consumers
See original GitHub issueI’ve been working on a Cesium-based project for a few months now, and picked Visual Studio Code as my primary editor. I was a little irritated that other libraries I rely on (like Moment and jQuery) have good feedback from Intellisense, while Cesium doesn’t give me anything (out of the box, at least). I learned that this is because the more popular libraries have a “Typings” file (.d.ts) either available from an external source, or bundled into the Node module directly.
I found this repo and placed the index.d.ts in my node_modules/cesium/ and like magic, VSCode knew the types of all the Cesium classes and functions – except that listing was last updated 4 months ago with version 1.26, so it was missing stuff that’s changed in the last half-dozen or so releases. I’ve added some things to it myself, though I wouldn’t say it’s definitely complete. I can post my modified version if anybody would like that.
I recognize that this would be an ongoing requirement, either to maintain manually or to generate as part of your build workflow, but I think it would really help out both those that try to use Cesium from actual Typescript, and those that work with vanilla-JS Cesium from VSCode.
Issue Analytics
- State:
- Created 6 years ago
- Comments:39 (36 by maintainers)

Top Related StackOverflow Question
@thw0rted I have move your gist to a public repo https://github.com/beginor/cesium-typings , this make it easy for others to contribute.
Any star or fork is welcome.
If anybody is tracking, I went ahead and hand-jammed some 1.37.0 updates to the Typings file I found earlier: https://gist.github.com/thw0rted/c0c73335c9968d5e7b6dd18a43ef6c42
I’m sure it’s still missing some information or wrong in places, and I don’t have automated tooling in place to generate this, which is what’s really needed. Still no workaround as far as I know for the issue I raised back in August – Typescript still really doesn’t want you to use getter/setter pairs the way Cesium does, so you might have to do use type guards or casts in your consuming code that wouldn’t otherwise be necessary.