How to use the isIdentifier function from typescript

Find comprehensive JavaScript typescript.isIdentifier code examples handpicked from public code repositorys.

63
64
65
66
67
68
69
70
71
72
if (ts.isPropertyAccessExpression(variable)) {
  const object = variable.expression;
  const propertyName = variable.name;
  if (
    ts.isExpressionStatement(object) &&
    ts.isIdentifier(propertyName) &&
    propertyName.text === "variable"
  ) {
    const newAssignment = ts.factory.createAssignment(
      ts.factory.createPropertyAccessExpression(
fork icon0
star icon0
watch icon1

+ 18 other calls in file

13
14
15
16
17
18
19
20
21
22
function objectLiteralExpression(expr) {
    return function_1.Maybe.lift(expr.arguments[0]).fmap(function (arg0) { return (arg0 && ts.isObjectLiteralExpression(arg0) ? arg0 : undefined); });
}
exports.objectLiteralExpression = objectLiteralExpression;
function withIdentifier(identifier) {
    return function_1.ifTrue(function (expr) { return ts.isIdentifier(expr.expression) && expr.expression.text === identifier; });
}
exports.withIdentifier = withIdentifier;
function isProperty(propName, p) {
    return ts.isPropertyAssignment(p) && ts.isIdentifier(p.name) && p.name.text === propName;
fork icon0
star icon0
watch icon1

82
83
84
85
86
87
88
89
90
91
    _super.prototype.visitNgPipe.call(this, metadata);
};
Walker.prototype.validateProperties = function (className, pipe) {
    var argument = utils_1.getDecoratorArgument(pipe);
    argument.properties
        .filter(function (p) { return p.name && ts.isIdentifier(p.name) && p.name.text === 'name'; })
        .forEach(this.validateProperty.bind(this, className));
};
Walker.prototype.validateProperty = function (className, property) {
    var initializer = ts.isPropertyAssignment(property) ? property.initializer : undefined;
fork icon0
star icon0
watch icon1

138
139
140
141
142
143
144
145
146
147
};
exports.getDecoratorName = function (decorator) {
    var expression = decorator.expression;
    if (typescript_1.isIdentifier(expression))
        return expression.text;
    if (typescript_1.isCallExpression(expression) && typescript_1.isIdentifier(expression.expression)) {
        return expression.expression.text;
    }
    return undefined;
};
fork icon0
star icon0
watch icon1

232
233
234
235
236
237
238
239
240
241
// __decorate$1([propDecorator()], FooClass, "propertyName", void 0);
const args = expression.arguments;
if (args.length > 2) {
    const isReferenced = args.some(arg => {
        const potentialIdentifier = ts.isPropertyAccessExpression(arg) ? arg.expression : arg;
        return ts.isIdentifier(potentialIdentifier) && potentialIdentifier.text === name;
    });
    if (isReferenced) {
        count++;
        continue;
fork icon0
star icon0
watch icon1

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)