-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src-transpiler/expandType: Implement
JSDocFunctionType
(#213)
* src-transpiler/expandType: Implement `JSDocFunctionType` * Add unit test
- Loading branch information
1 parent
2f9e342
commit 4f368cf
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @param {function (number, number): number} cb | ||
*/ | ||
function op(cb, a, b) { | ||
return cb(a, b); | ||
} | ||
const ret = op((a, b) => a + b, 10, 20); | ||
console.log("ret", ret); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @param {function (number, number): number} cb | ||
*/ | ||
function op(cb, a, b) { | ||
if (!inspectType(cb, { | ||
"type": "function", | ||
"parameters": [ | ||
{ | ||
"type": "number", | ||
"name": "undefined" | ||
}, | ||
{ | ||
"type": "number", | ||
"name": "undefined" | ||
} | ||
], | ||
"optional": false | ||
}, 'op', 'cb')) { | ||
youCanAddABreakpointHere(); | ||
} | ||
return cb(a, b); | ||
} | ||
const ret = op((a, b) => { | ||
return a + b; | ||
}, 10, 20); | ||
console.log("ret", ret); |