DefinitelyTyped/types/lazy-property/lazy-property-tests.ts
Jan 9156059301 Lazy property (#38379)
* [lazy-property] added type definitions

* [lazy-property] fixed tests and lint
2019-09-16 12:29:55 -07:00

11 lines
176 B
TypeScript

import addLazyProperty = require('lazy-property');
const obj: { foo?: string } = {};
addLazyProperty(obj, 'foo', () => {
return 'bar';
});
// Access the property
obj.foo;