forked from dsherret/ts-morph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JsxExpression.ts
33 lines (29 loc) · 1.12 KB
/
JsxExpression.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as errors from "../../../errors";
import { ts, SyntaxKind } from "../../../typescript";
import { Expression } from "../expression";
export class JsxExpression extends Expression<ts.JsxExpression> {
/**
* Gets the dot dot dot token (...) or throws if it doesn't exist.
*/
getDotDotDotTokenOrThrow() {
return errors.throwIfNullOrUndefined(this.getDotDotDotToken(), "Expected to find a dot dot dot token for the JSX expression.");
}
/**
* Gets the dot dot dot token (...) or returns undefined if it doesn't exist.
*/
getDotDotDotToken() {
return this._getNodeFromCompilerNodeIfExists(this.compilerNode.dotDotDotToken);
}
/**
* Gets the expression or throws if it doesn't exist.
*/
getExpressionOrThrow() {
return errors.throwIfNullOrUndefined(this.getExpression(), "Expected to find an expression for the JSX expression.");
}
/**
* Gets the expression or returns undefined if it doesn't exist
*/
getExpression(): Expression | undefined {
return this._getNodeFromCompilerNodeIfExists(this.compilerNode.expression);
}
}