Skip to content

Commit

Permalink
fix: type for async property
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed May 29, 2018
1 parent 082162a commit 4cb9497
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ function lazyAssLogic(condition) {
}
}

export const lazyAss = function lazyAss() {
interface LazyAss {
(): void;
async: () => void;
}

export const lazyAss: LazyAss = <LazyAss>function lazyAss() {
var err = lazyAssLogic.apply(null, arguments);
if (err) {
throw err;
Expand All @@ -139,7 +144,6 @@ export const lazyAssync = function lazyAssync() {
}
};

// TODO how to add a property to a function?
// lazyAss.async = lazyAssync;
lazyAss.async = lazyAssync;

export default lazyAss;
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* Enable strict null checks. */
"strictFunctionTypes": true, /* Enable strict checking of function types. */
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
"strictPropertyInitialization": false, /* Enable strict checking of property initialization in classes. */
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

Expand Down

0 comments on commit 4cb9497

Please sign in to comment.