-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
They probably need to be broken now, here's an exerpt from models.ts
xport type ModelingCmd_type =
| 'StartPath'
| {
MovePathPen: {
path: ModelingCmdId_type /* The ID of the command which created the path. */;
to: Point3d_type /* Where the path's pen should be. */;
};
}
// ...
the union of a string and an object means that user's can't be more specific like
type MoreSpecificType = ModelingCmd_type['MovePathPen'] // not possible
Here are some hacks we're already using in the app to get around this
type SketchModeCmd = Extract<
EngineCommand['cmd'],
{ DefaultCameraEnableSketchMode: any }
>['DefaultCameraEnableSketchMode'];
and
const command: Models['ModelingCmdReq_type'] = {/*...*/}
const cmd: = command.cmd
if (typeof cmd !== 'string' && "CameraDragMove" in cmd && this.lossyDataChannel) {
// do stuff with CameraDragMove cmd
}
These are good work around but wouldn't want other users of this lib to have to do trick typescript stuff like this.
Metadata
Metadata
Assignees
Labels
No labels