You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Javascript doesn't have any mechanism to access static members, only creatable objects (new ActiveXObject(...))
modules -- collection of named constants
enums -- two aspects:
named constants
limited set of values
Typescript's const enum can be used to model ActiveX enums, because they can be defined in an ambient context and the values are inlined into the calling code
but only for ActiveX enums; ActiveX modules do not constrain to a limited set of values, only assign names to them
const enum is limited to numbers. This means:
no string-based enums, or enums of any other type
Non-numeric enums should be emitted as type declarations, which will allow for compile-time limitation to those values.
type CommandID =
"{04E725B0-ACAE-11D2-A093-00C04F72DC3C}" |
"{E208C170-ACAD-11D2-A093-00C04F72DC3C}" ...
COM modules should be emitted as an additional file with runtime-assigned constants.
With the introduction of microsoft/TypeScript#15486, it is now possible to output const enums with string values in definition files, as well as mixed string/numeric enums.
Currently,
new ActiveXObject(...)
)const enum
can be used to model ActiveX enums, because they can be defined in an ambient context and the values are inlined into the calling codeconst enum
is limited to numbers. This means:Non-numeric enums should be emitted as type declarations, which will allow for compile-time limitation to those values.
COM modules should be emitted as an additional file with runtime-assigned constants.
See also here
The text was updated successfully, but these errors were encountered: