1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var ts = require("typescript");
|
4 | var namedDeclarationKinds = [
|
5 | ts.SyntaxKind.InterfaceDeclaration,
|
6 | ts.SyntaxKind.ClassDeclaration,
|
7 | ts.SyntaxKind.EnumDeclaration,
|
8 | ts.SyntaxKind.TypeAliasDeclaration,
|
9 | ts.SyntaxKind.ModuleDeclaration,
|
10 | ts.SyntaxKind.FunctionDeclaration,
|
11 | ts.SyntaxKind.VariableDeclaration,
|
12 | ];
|
13 | function isNodeNamedDeclaration(node) {
|
14 | return namedDeclarationKinds.indexOf(node.kind) !== -1;
|
15 | }
|
16 | exports.isNodeNamedDeclaration = isNodeNamedDeclaration;
|
17 | function hasNodeModifier(node, modifier) {
|
18 | return Boolean(node.modifiers && node.modifiers.some(function (nodeModifier) { return nodeModifier.kind === modifier; }));
|
19 | }
|
20 | exports.hasNodeModifier = hasNodeModifier;
|
21 | function getActualSymbol(symbol, typeChecker) {
|
22 | if (symbol.flags & ts.SymbolFlags.Alias) {
|
23 | symbol = typeChecker.getAliasedSymbol(symbol);
|
24 | }
|
25 | return symbol;
|
26 | }
|
27 | exports.getActualSymbol = getActualSymbol;
|
28 |
|
29 |
|
30 |
|
31 | function isDeclareModuleStatement(statement) {
|
32 |
|
33 |
|
34 | return ts.isModuleDeclaration(statement) && !(statement.flags & ts.NodeFlags.Namespace) && !(statement.flags & ts.NodeFlags.GlobalAugmentation);
|
35 | }
|
36 | exports.isDeclareModuleStatement = isDeclareModuleStatement;
|
37 |
|
38 |
|
39 |
|
40 | function isDeclareGlobalStatement(statement) {
|
41 | return ts.isModuleDeclaration(statement) && Boolean(statement.flags & ts.NodeFlags.GlobalAugmentation);
|
42 | }
|
43 | exports.isDeclareGlobalStatement = isDeclareGlobalStatement;
|
44 |
|
45 |
|
46 |
|
47 | function isNamespaceStatement(node) {
|
48 | return ts.isModuleDeclaration(node) && Boolean(node.flags & ts.NodeFlags.Namespace);
|
49 | }
|
50 | exports.isNamespaceStatement = isNamespaceStatement;
|