zspitz / ts-activex-gen

Library + UI for generating Typescript definitions / DefinitelyTyped packages from COM type libraries / LibreOffice Doxygen XML
MIT License
12 stars 4 forks source link

Candidates for possible Typescript AST transformations #17

Open zspitz opened 7 years ago

zspitz commented 7 years ago

https://github.com/Microsoft/TypeScript/issues/6508

zspitz commented 7 years ago

Simulate default properties:

var rst: DAO.Recordset;
var lastName: string = rst('LastName');

would map to

var rst: DAO.Recordset;
var lastName: string = rst.Fields('LastName').Value;

because we know the type of lastName, we can step through the default property chain (Fields, Value) until we reach a compatible property. Alternatively, the default property chain should be followed until the end, and lastName would have the type of .Value.