docsforadobe / Types-for-Adobe

TypeScript types for Adobe: AfterEffects, Animate, Audition, Illustrator, InDesign, Photoshop, Premiere, ScriptUI.
517 stars 124 forks source link

`Point` & friends should be declared as class #52

Closed martijnthe closed 5 years ago

martijnthe commented 5 years ago

Right now ScriptUI.d.ts contains declarations such as:

declare type Point = _Point | [number, number]
declare class _Point { ...

https://github.com/pravdomil/Types-for-Adobe/blob/master/shared/ScriptUI.d.ts#L2030

The problem with this is that it prevents one from writing:

const p = new Point(1, 2);

The compiler will yell when you do this:

error TS2693: 'Point' only refers to a type, but is being used as a value here.

Point is actually a class, so I think it should be declared as one.

Does it make sense to change it to:

declare type _Point = Point | [number, number]
declare class Point { ...

cc @vespakoen

pravdomil commented 5 years ago

fixed in https://github.com/pravdomil/Types-for-Adobe/commit/26d3ef2e27ec5e1f6a22f36a306d9296323ecf2f