How to use the isPropertyAssignment function from typescript

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

65
66
67
68
69
70
71
72
73
74
NoFeatureServiceProvidedRootWalker.prototype.localizeExpresionSyntaxis = function (node) {
    var _this = this;
    return node.getChildren().some(function (element) { return element.kind === ts.SyntaxKind.SyntaxList && _this.localizeProvideInRoot(element); });
};
NoFeatureServiceProvidedRootWalker.prototype.localizeProvideInRoot = function (node) {
    return node.getChildren().find(function (element) { return ts.isPropertyAssignment(element)
        && element.name.getText() === 'providedIn'
        && element.initializer.getText() === '\'root\''; });
};
return NoFeatureServiceProvidedRootWalker;
fork icon1
star icon0
watch icon1

17
18
19
20
21
22
23
24
25
26
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;
}
exports.isProperty = isProperty;
function getInitializer(p) {
    return function_1.Maybe.lift(p && ts.isPropertyAssignment(p) && ts.isIdentifier(p.name) ? p.initializer : undefined);
fork icon0
star icon0
watch icon1

86
87
88
89
90
91
92
93
94
95
    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;
    if (initializer && ts.isStringLiteral(initializer)) {
        var propName = initializer.text;
        var isValid = this.rule.validatePrefix(propName);
        if (!isValid) {
fork icon0
star icon0
watch icon1

400
401
402
403
404
405
406
407
408
409
    })
        .reduce((accum, toRm) => accum.concat(toRm), []);
    // If every node to be removed is a property assignment (full property's decorators) and
    // all properties are accounted for, remove the whole assignment. Otherwise, remove the
    // nodes which were marked as safe.
    if (toRemove.length === assignments.length && toRemove.every((node) => ts.isPropertyAssignment(node))) {
        return [exprStmt];
    }
    return toRemove;
}
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)