Migrate cesium-compass to typescript - #159
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the cesium-compass package from JavaScript with JSDoc type annotations to TypeScript with decorators. The migration modernizes the build configuration and code structure to use native TypeScript features instead of JavaScript with type comments.
- Converts the main component file from JavaScript to TypeScript
- Replaces JSDoc type annotations with TypeScript types and interfaces
- Migrates from
static get properties()to decorator-based property definitions using@propertyand@state
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Updated TypeScript configuration with ES2021 target, added lib options, and enabled experimental decorators |
| packages/cesium-compass/tsconfig.json | Added package-specific TypeScript configuration with decorator support |
| packages/cesium-compass/package.json | Added "type": "module", defined source file, and added build script |
| packages/cesium-compass/cesium-compass.ts | Converted from JSDoc to TypeScript with decorators, added type annotations and interfaces |
| demos/cesium-compass.html | Updated demo to load TypeScript source file instead of compiled JavaScript |
Comments suppressed due to low confidence (2)
packages/cesium-compass/cesium-compass.ts:158
- Debug console.log statement should be removed before merging to production.
packages/cesium-compass/cesium-compass.ts:50 - The FIXME comment suggests uncertainty about the initial value. Since this is a TypeScript migration, the type should be either
boolean(initialized tofalse) orboolean | undefinedifundefinedis a valid state. The comment should be resolved or removed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <script src="https://cesium.com/downloads/cesiumjs/releases/1.134/Build/Cesium/Cesium.js"></script> | ||
| <link href="https://cesium.com/downloads/cesiumjs/releases/1.134/Build/Cesium/Widgets/widgets.css" rel="stylesheet"> | ||
| <script src="../packages/cesium-compass/cesium-compass.js" type="module"></script> | ||
| <script src="../packages/cesium-compass/cesium-compass.ts" type="module"></script> |
There was a problem hiding this comment.
The demo is loading the TypeScript source file directly. This will only work in development with a transpiler. For a production demo, this should load the compiled JavaScript file (cesium-compass.js) as defined in package.json's 'main' field.
| <script src="../packages/cesium-compass/cesium-compass.ts" type="module"></script> | |
| <script src="../packages/cesium-compass/cesium-compass.js" type="module"></script> |
No description provided.