We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class SomeA { foo(expr?: Expression<() => number>) {} bar(expr?: Expression<() => number>) { this.foo(expr) } } new SomeA().bar(() => 10)
foo method gets identifier as the expression. Without the question mark, works as expected.
foo
identifier
The text was updated successfully, but these errors were encountered:
It works as expected. Can you create a repro?
EDIT: Hmm.. I'm wordering... You have both the tst-expression and the tst-reflect installed, right? Maybe they have some conflict.. /EDIT
tst-expression
tst-reflect
What I tried:
import { Expression, assertExpression, assertArrowFunctionExpression, assertNumericLiteral } from "tst-expression"; class SomeA { foo(expr?: Expression<() => number>) { if (!expr) { return; } assertExpression(expr); assertArrowFunctionExpression(expr.expression); console.log("# parameters:", expr.expression.parameters.length); assertNumericLiteral(expr.expression.body); console.log("number in body:", Number(expr.expression.body.text)); } bar(expr?: Expression<() => number>) { this.foo(expr) } } new SomeA().bar(() => 10);
Transpiled code:
import {assertExpression, assertArrowFunctionExpression, assertNumericLiteral} from "tst-expression"; class SomeA { foo(expr) { if (!expr) { return; } assertExpression(expr); assertArrowFunctionExpression(expr.expression); console.log("# parameters:", expr.expression.parameters.length); assertNumericLiteral(expr.expression.body); console.log("number in body:", Number(expr.expression.body.text)); } bar(expr) { this.foo(expr); } } new SomeA().bar({ compiled: () => 10, context: {}, expression: { "flags": 256, "kind": 212, "locals": {}, "parameters": [], "body": { "flags": 0, "kind": 8, "text": "10", "numericLiteralFlags": 0 }, "equalsGreaterThanToken": { "flags": 0, "kind": 38 }, "endFlowNode": {"flags": 2} } });
Sorry, something went wrong.
No branches or pull requests
foo
method getsidentifier
as the expression. Without the question mark, works as expected.The text was updated successfully, but these errors were encountered: