Coder Social home page Coder Social logo

buehler / node-typescript-parser Goto Github PK

View Code? Open in Web Editor NEW
143.0 143.0 46.0 633 KB

Parser for typescript (and javascript) files, that compiles those files and generates a human understandable AST.

License: MIT License

TypeScript 99.83% JavaScript 0.17%
ast ecmascript parser parsing typescript typescript-parser

node-typescript-parser's Introduction

Metrics

node-typescript-parser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-typescript-parser's Issues

docs: user guide

I'm using this parser within a yeoman generator to parse angular 4 services, components, along with their usual decorators, but I'm finding it time consuming learning how to best drive your parser interface relying solely on deep diving into your code base, unit tests and the various reference style html docs.

I'd much appreciate any links you might have to additional material, user guide style docs, tutorials, extensive code samples and anything else to help. Cheers guys, a nice project and very useful, thanks for your efforts.

Add more information on return type of methods

FunctionDeclaration {
  name: 'getNotificationSettingsForUser',
  isExported: false,
  type: 'Promise<{\n    notificationRows: any;\n}>',
  start: 5886,
  end: 6006,
  parameters:
   [ ParameterDeclaration { name: 'this', type: 'ApiHandler', start: 5934, end: 5950 },
     ParameterDeclaration { name: 'userID', type: 'any', start: 5952, end: 5963 } ],
  variables: [] }

The type variable is all string, how can we improve analysis to get at its structure?

An in-range update of @types/lodash-es is breaking the build 🚨

Version 4.17.1 of @types/lodash-es was just published.

Branch Build failing 🚨
Dependency @types/lodash-es
Current Version 4.17.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/lodash-es is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • βœ… codecov/patch Coverage not affected when comparing 596e150...647b3cc Details
  • ❌ codecov/project 90.12% (-0.11%) compared to 596e150 Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build is in progress Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

All variables and parameters have type undefined(JS)

I have a js script.
In it I have this function:

getMore(a,b=32){
        var test = 1
        return a+b+test;
};

In this instance the "test" var is assigned a "int" and "b" also but when parsed only outputs type: undefined i.e.:

getMore
[ VariableDeclaration {
    name: 'test',
    isConst: false,
    isExported: false,
    type: undefined,
    start: 394,
    end: 406 } ]

The type of the function also returns undefined. Is this normal behavior or is this an issue with the parser or the typescript compiler ?

Emit JSDoc-style comments

Hello, thanks for this project πŸ‘
One thing I would like to have is the JsDoc comments associated with a declaration:

/**
 * A meaningless declaration.
 */
const hello = "world";

current result:

VariableDeclaration {
       name: 'hello',
       isConst: true,
       isExported: false,
       type: undefined,
       start: 38,
       end: 60 }

desired result:

VariableDeclaration {
       comment: '/**\n * A meaningless declaration.\n */',
       name: 'hello',
       isConst: true,
       isExported: false,
       type: undefined,
       start: 38,
       end: 60 }

Thank you for this module.

I am currently creating a unit test generator for Angular 5+.
https://github.com/allenhwkim/ng-gen-test

This module is super useful for that purpose. So far, your module is the best that I have found.
Although there is another way that I found, but the usage is not very comfortable for me, https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API.

I also found that the README.md is not very novice-friendly and detailed.

I have just test tested this, and I just wanted to say thank you.

I will also provide more details on update of README.md later

How to actually inspect the code?

Is it possible to actually inspect the code with this library? I'm coming from using esprima in js, and I'm hoping to be able to parse typescript, and inspect values passed into method calls etc. Is this possible with this library?...am I just missing something?

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.10.1 to 10.10.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of semantic-release is breaking the build 🚨

The devDependency semantic-release was updated from 15.9.15 to 15.9.16.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for v15.9.16

15.9.16 (2018-09-19)

Bug Fixes

  • package: update env-ci to version 3.0.0 (b9ae7d2)
Commits

The new version differs by 2 commits.

  • b9ae7d2 fix(package): update env-ci to version 3.0.0
  • c27e18e chore(package): update nock to version 10.0.0

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

[Bug] Unclear default export

Given the file:

export default class MyClass {
    // MyClass implementation
}

The parsed File object has following declarations:

[
    DefaultDeclaration: {
        isExported: true,
        exportedDeclaration: self
    },
    ClassDeclaration (MyClass): {
        isExported: false
    }
]

Expected:

  • ClassDeclaration.isExported to be true
  • DefaultDeclaration.exportedDeclaration to be MyClass declaration

An in-range update of @types/jest is breaking the build 🚨

The devDependency @types/jest was updated from 23.3.2 to 23.3.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch: Waiting for AppVeyor build to complete (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Why not export a sync parse method?

Since parse might be used in some pipeline operation, not all these pipelines are promise-friendly.

And this method could have been sync:

public async parseFiles(
        filePathes: string[],
        rootPath: string): Promise<File[]> {
        return filePathes
            .map((o) => {
                let scriptKind: ScriptKind = ScriptKind.Unknown;
                const parsed = parse(o);
                switch (parsed.ext.toLowerCase()) {
                    case 'js':
                        scriptKind = ScriptKind.JS;
                        break;
                    case 'jsx':
                        scriptKind = ScriptKind.JSX;
                        break;
                    case 'ts':
                        scriptKind = ScriptKind.TS;
                        break;
                    case 'tsx':
                        scriptKind = ScriptKind.TSX;
                        break;
                }
                return createSourceFile(
                    o,
                    readFileSync(o).toString(),
                    ScriptTarget.ES2015,
                    true,
                    scriptKind,
                );
            })
            .map(o => this.parseTypescript(o, rootPath));
    }

Link to docs in repo description is outdated.

The link to docs in the repo's description is outdated. I'm referring to this text:
chrome_2018-03-10_22-09-19

That link goes to https://typescript-heroes.github.io/node-typescript-parser/ which no longer exists. Using my amazing powers of deduction I found it hosted under your username (@buehler) at: https://buehler.github.io/node-typescript-parser/

I assume you changed your name or something and never updated the link.

I would also suggest including the link to the docs in the README.md. I'll make a quick PR for yah, but I can't propose changes to the repo description, that's something you'll have to update.

Anyway awesome project. Keep up the great work!

Not correct exports

Hello.
My test source file is

import { readFileSync, writeFile } from 'fs';
import * as ts from 'typescript';

import { writeFile as write } from 'fs';

export function delit(sourceFile: ts.SourceFile) {

    delintNode(sourceFile);

    function delintNode(node: ts.Node) {
        switch (node.kind) {
            case ts.SyntaxKind.ImportClause:
            case ts.SyntaxKind.ImplementsKeyword:
            case ts.SyntaxKind.ImportDeclaration:
            case ts.SyntaxKind.ImportSpecifier:
            case ts.SyntaxKind.NamedImports:
                console.log(node);
                break;
        }
        ts.forEachChild(node, delintNode);
    }
}

const fileName = '';
const sourceFile = ts.createSourceFile('test', readFileSync(fileName).toString(), ts.ScriptTarget.ES2015, /*setParentNodes */ true);
delit(sourceFile);

export const d = 5;
const a = [readFileSync];
ts.createSourceFile(null, null, null);

interface Foo {
    a: string;
}

const b: Foo = { a: 'a' };

const node: ts.NodeArray<ts.Node> = [];

And parsed AST is:

File {
  filePath: 'inline.tsx',
  rootPath: '/',
  start: 0,
  end: 1030,
  imports:
   [ NamedImport { libraryName: 'fs', start: 0, end: 45, specifiers: [Array] },
     NamespaceImport { libraryName: 'typescript', alias: 'ts', start: 47, end: 80 },
     NamedImport { libraryName: 'fs', start: 84, end: 124, specifiers: [Array] } ],
  exports: [],
  declarations:
   [ FunctionDeclaration {
       name: 'delit',
       isExported: true,
       type: undefined,
       start: 128,
       end: 651,
       parameters: [Array],
       variables: [] },
     VariableDeclaration {
       name: 'fileName',
       isConst: true,
       isExported: false,
       type: undefined,
       start: 655,
       end: 675 },
     VariableDeclaration {
       name: 'sourceFile',
       isConst: true,
       isExported: false,
       type: undefined,
       start: 677,
       end: 809 },
     VariableDeclaration {
       name: 'd',
       isConst: true,
       isExported: true,
       type: undefined,
       start: 833,
       end: 852 },
     VariableDeclaration {
       name: 'a',
       isConst: true,
       isExported: false,
       type: undefined,
       start: 854,
       end: 879 },
     InterfaceDeclaration {
       name: 'Foo',
       isExported: false,
       start: 923,
       end: 957,
       properties: [Array],
       methods: [] },
     VariableDeclaration {
       name: 'b',
       isConst: true,
       isExported: false,
       type: 'Foo',
       start: 961,
       end: 987 },
     VariableDeclaration {
       name: 'node',
       isConst: true,
       isExported: false,
       type: 'ts.NodeArray<ts.Node>',
       start: 991,
       end: 1030 } ],
  resources: [],
  usages:
   [ 'sourceFile',
     'ts',
     'SourceFile',
     'delintNode',
     'node',
     'Node',
     'console',
     'fileName',
     'readFileSync',
     'delit',
     'd',
     'a',
     'b',
     'Foo',
     'NodeArray' ] }

Expected:
Exports to be delint and d.

I'm right? I found that ts 2.6.2 founds only ExportKeyword in AST.

Can't test if declaration is ConstructableDeclaration(JS)

We can test if a declaration is callable but not if it is constructable.

The use case for that is that if you have a js file like this:

function Apple (type) {
    var test = 1
    this.type = type;
    color ={
        color: "red"
    }
    this.getInfo = function() {
        return this.color + ' ' + this.type + ' apple'+test;
    };
}

This is essentially a class declaration(i.e. in the sense that this is a constructor to something that can and will be called as a class). But functions are not necessarily only functions in javascript from what I have read in this so I don't know if it is feasible to detect functions that are class declarations.

Possible solution:

Looking at the body of the function and the this keyword is used flag the function as being a class. This gave me the idea for this solution but it's relatively hackish.

Suggestion : annotations

hello,
I love your parser!
can you add the possibility to manage the annotation in typescript to your project?

Non-async parseSource

What about non-async parseSource? For example:

console.log(parser.normalParseSource(/* ... */))

Instead of

parser.parseSource(/* ... */).then(o => {
     console.log(o)
     console.log('Exports:', o.exports)
})

Recognize default export and left-hand-side of subscripting operator as usages and nonLocalUsages

Default exports that are merely an identifier, not an expression, and the left-hand-side of the subscripting operator seem to be ignored by usages and/or nonLocalUsages.

import {TypescriptParser} from 'typescript-parser';
new TypescriptParser().parseSource(`
    export default foo;
    bar[baz];
`).then(function(p) {
    console.log(p.usages, p.nonLocalUsages);
});
// Prints [ 'foo', 'baz' ] [ 'baz' ]
// Should print ['foo', 'bar', 'baz'] ['foo', 'bar', 'baz']

An in-range update of ts-jest is breaking the build 🚨

☝️ Greenkeeper’s updated Terms of Service will come into effect on April 6th, 2018.

Version 22.4.2 of ts-jest was just published.

Branch Build failing 🚨
Dependency ts-jest
Current Version 22.4.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… continuous-integration/travis-ci/push The Travis CI build passed Details
  • ❌ codecov/project 89.21% (-0.11%) compared to 919947b Details
  • βœ… codecov/patch Coverage not affected when comparing 919947b...8ce8f06 Details

Release Notes 22.4.2

added a flag to allow disabling sourcemap support

{
  "globals: {
    "ts-jest": {
      "disableSourceMapSupport": true
    }
  }
}
Commits

The new version differs by 16 commits.

  • b4628f0 Merge pull request #470 from kulshekhar/sms-flag
  • e4bb8a9 allow disabling sourcemap support
  • 50e9be7 bump version patch
  • 17c6872 Long path (#461)
  • 4a338b0 Merge pull request #458 from AhnpGit/chore/update-dependencies
  • f114cbd Merge branch 'chore/update-dependencies' of https://github.com/AhnpGit/ts-jest into chore/update-dependencies
  • fb1e5e2 Keep dependencies independent from Jest
  • 54c84c2 Merge branch 'master' into chore/update-dependencies
  • e925491 Merge branch 'master' into chore/update-dependencies
  • 4a07d52 Merge pull request #459 from AhnpGit/fix/sync-types-with-jest
  • 8fc8215 Small adjustments for optional type
  • c394dcc Update types for FullJestConfig to be in sync with types in Jest
  • 2808a95 Remove jest-config because Jest already installed it
  • abedcbc Bring back babel-plugin-transform-es2015-modules-commonjs dependency
  • 63786af Fix tslint

There are 16 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

type properties are not parsed

script

import { TypescriptParser } from 'typescript-parser';

const json = (data: any): string => JSON.stringify(data, null, '  ');

async function main() {
    const timerToPreventFreeze = setTimeout(() => {}, 999999);
    const parser = new TypescriptParser();
    console.log('# interface');
    console.log();
    console.log(json(await parser.parseSource(`
        interface A {
            n: number;
            s: string;
        }
    `)));
    console.log();
    console.log('# type');
    console.log();
    console.log(json(await parser.parseSource(`
        type A = {
            n: number;
            s: string;
        }
    `)));
    clearTimeout(timerToPreventFreeze);
  }

  main().then(() => {
    process.exit()
  });

Result

# interface

{
  "filePath": "inline.tsx",
  "rootPath": "/",
  "start": 9,
  "end": 83,
  "imports": [],
  "exports": [],
  "declarations": [
    {
      "name": "A",
      "isExported": false,
      "start": 9,
      "end": 78,
      "accessors": [],
      "properties": [
        {
          "name": "n",
          "visibility": 2,
          "type": "number",
          "isOptional": false,
          "isStatic": false,
          "start": 35,
          "end": 45
        },
        {
          "name": "s",
          "visibility": 2,
          "type": "string",
          "isOptional": false,
          "isStatic": false,
          "start": 58,
          "end": 68
        }
      ],
      "methods": []
    }
  ],
  "resources": [],
  "usages": [
    "n",
    "s"
  ]
}

# type

{
  "filePath": "inline.tsx",
  "rootPath": "/",
  "start": 9,
  "end": 80,
  "imports": [],
  "exports": [],
  "declarations": [
    {
      "name": "A",
      "isExported": false,
      "start": 9,
      "end": 75
    }
  ],
  "resources": [],
  "usages": [
    "n",
    "s"
  ]
}

An in-range update of ts-jest is breaking the build 🚨

Version 23.1.0 of ts-jest was just published.

Branch Build failing 🚨
Dependency ts-jest
Current Version 23.0.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Commits

The new version differs by 39 commits.

  • 6916e7b Merge pull request #650 from kulshekhar/kulshekhar-patch-1
  • 54a30eb Bump the version (minor)
  • 9e61969 Merge pull request #626 from huafu/feature/upgrade-babel-and-fix-tsconfig
  • ef21f50 Merge branch 'master' into feature/upgrade-babel-and-fix-tsconfig
  • c67ba4d Merge pull request #649 from kulshekhar/greenkeeper/monorepo.react-16.4.2
  • 9a6904f Merge branch 'master' of https://github.com/kulshekhar/ts-jest into feature/upgrade-babel-and-fix-tsconfig
  • 8a94008 chore(package): update react-test-renderer to version 16.4.2
  • 6e73fb9 chore(package): update react to version 16.4.2
  • c947791 chore(package): update @types/node to version 10.5.5 (#646)
  • fd24ae6 Merge pull request #640 from jmheik/to-dev-deps
  • e2028da Merge branch 'master' into to-dev-deps
  • 4396dde Merge pull request #641 from jeznag/patch-1
  • 7d78123 Merge branch 'master' into patch-1
  • b38e4ca Add TypeScript ^3.0.0 as supported peer dependencies (#644)
  • 1e287f3 Add more details on using module name mapper

There are 39 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Why use this instead of the official typescript parser?

Why use this instead of the official typescript parser?

import * as ts from 'typescript'; const sourceFile: ts.SourceFile = ts.createSourceFile( 'test.ts', 'const r = 5', ts.ScriptTarget.ES2015, true, ts.ScriptKind.TS );

An in-range update of semantic-release is breaking the build 🚨

Version 15.9.1 of semantic-release was just published.

Branch Build failing 🚨
Dependency semantic-release
Current Version 15.9.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

semantic-release is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… continuous-integration/travis-ci/push: The Travis CI build passed (Details).
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes v15.9.1

15.9.1 (2018-07-30)

Bug Fixes

  • clarify EPLUGINCONF error message (d8c84a0)
Commits

The new version differs by 3 commits.

  • b2d82c2 docs: specify for each step if one or more plugins are required/allowed
  • 31ec1eb docs: fix configuration doc syntax
  • d8c84a0 fix: clarify EPLUGINCONF error message

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

How to get parsed data ( key -> value) of Class Decorator

Hi @buehler ,
I can see that, I am not getting parsed data for class decorator. How can I get this data provided in decorator. I am using it for angular files

e.g.
import { Component } from '@angular/core';

@component({
selector: 'app-root',
template: <h1>{{title}}</h1> <h2>My favorite hero is: {{myHero}}</h2>

})
export class AppComponent {
title = 'Tour of Heroes';
myHero = 'Windstorm';
}

Here , I need selector and template values from decorator. Is there any way / configuration to get this data using parseSource or parseFile ?

Missing metadata in AllExport when using alias

Steps to reproduce

import * from './subtest/test1'
import * as test2 from './subtest/test2' // ← broken case

Current behavior

Both will create something like:

{ e: AllExport { start: 0, end: 31, from: './subtest/test1' } }
{ e: AllExport { start: 32, end: 76, from: './subtest/test2' } }

Expected behavior

test2 should also have a specifiers: [ SymbolSpecifier { specifier: 'test2', alias: undefined } ]

Parser returns "undefined" for complex types of fields

When parsing Typescript-Files, nearly every information is returned, which is really great - thank you for the great job you've done! Unfortuantely, on processing the PropertyDeclarations, the type thereof is "undefined" in case of complex types (i.e., if a property has a type of another Typescript class for example).

Is there a possiblity that in such a case the name of the class is returned instead of "undefined" or accessed in any other way?

Thank you very much in advance!

add isStatic flag to method/property AST

Source :

 static new<T extends keyof DataTypes = keyof DataTypes>(
        value: number|boolean, dtype?: T) {
        const values = [value] as number[] | boolean[];
        return new Scalar({values: toTypedArray(values, dtype)}, dtype);
    }

    static ZERO = Scalar.new(0);
    static ONE = Scalar.new(1);
    static TWO = Scalar.new(2);
    static NEG_ONE = Scalar.new(-1);

    get(): number {
        return this.getValues()[0];
    }

parsed AST

  "properties": [
        {
          "name": "ZERO",
          "start": 15199,
          "end": 15227
        },
        {
          "name": "ONE",
          "start": 15232,
          "end": 15259
        },
        {
          "name": "TWO",
          "start": 15264,
          "end": 15291
        },
        {
          "name": "NEG_ONE",
          "start": 15296,
          "end": 15328
        }
      ],
      "methods": [
        {
          "name": "new",
          "isAbstract": false,
          "start": 14958,
          "end": 15193,
          "parameters": [
            {
              "name": "value",
              "type": "number|boolean",
              "start": 15023,
              "end": 15044
            },
            {
              "name": "dtype",
              "type": "T",
              "start": 15046,
              "end": 15055
            }
          ],
          "variables": [
            {
              "name": "values",
              "isConst": true,
              "isExported": false,
              "start": 15067,
              "end": 15114
            }
          ]
        },
        {
          "name": "get",
          "isAbstract": false,
          "type": "number",
          "start": 15334,
          "end": 15391,
          "parameters": [],
          "variables": []
        },
        {
          "name": "val",
          "isAbstract": false,
          "type": "Promise<number>",
          "start": 15397,
          "end": 15487,
          "parameters": [],
          "variables": []
        },
        {
          "name": "set",
          "isAbstract": false,
          "start": 15493,
          "end": 15556,
          "parameters": [
            {
              "name": "value",
              "type": "number",
              "start": 15497,
              "end": 15510
            }
          ],
          "variables": []
        },
....

new method is static but there is no way to assert the same in AST , same for properties ..

An in-range update of @types/jest is breaking the build 🚨

Version 23.1.3 of @types/jest was just published.

Branch Build failing 🚨
Dependency @types/jest
Current Version 23.1.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

`file.exports` always returns empty array

Hey there!

Given the following input code:

export const add = async (
   data: {num1: number, num2: number}
) => {
   console.log(`Adding ${num1} + ${num2}`)

   return data.num1 + data.num2
}

export default {
   name: "example-module",
}

file.exports returns an empty array.

Am I using this library wrong, or isn't file.exports implemented yet?

An in-range update of mock-fs is breaking the build 🚨

Version 4.6.0 of mock-fs was just published.

Branch Build failing 🚨
Dependency mock-fs
Current Version 4.5.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

mock-fs is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… continuous-integration/appveyor/branch: AppVeyor build succeeded (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 7 commits.

  • 96b28b6 4.6.0
  • 6906f02 Log changes
  • 0bb6314 Merge pull request #243 from tschaub/copy-file
  • 8bf0d3c Implement binding.copyFile()
  • c1cdeec Merge pull request #241 from tschaub/partial-ten-five-fix
  • e97697b Conditionally define BigUint64Array
  • 192ce18 Fix stat calls to work with changes in Node 10

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Question: Is there a way to print back the modified AST

I am able to parse the typescript source into AST. And I am able to modify the AST. But I am not sure how to print back the AST as the source file.

If this is not possible with this library, please let me know if there is any way to achieve this. Thank you.

An in-range update of tslib is breaking the build 🚨

Version 1.9.3 of tslib was just published.

Branch Build failing 🚨
Dependency [tslib](https://github.com/Microsoft/tslib)
Current Version 1.9.2
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

tslib is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • βœ… continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • ❌ continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes tslib 1.9.3

This release changes the __extends and __assign helper functions so that certain tools may more easily analyze them. Details are available on Microsoft/TypeScript#24244.

Commits

The new version differs by 2 commits.

  • 9dd9aa3 Update version to '1.9.3'.
  • 4dc67f4 Update helpers to use redefining pattern if needed (related to Microsoft/TypeScript#24244) (#54)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Missing parsed information

Parser unfortunately doesn't return full information about parsed code.

Right now I know about missing

  • async flag (#66)
  • isStatic flag (#43)
  • propertyIsOptional flag (e.g. { myProperty?: string } )
  • while parsing property of type Object (e.g. { myProperty: { innerPropery: string } }, the type is not fully parsed and returns values like
    {\n email: string\n }
    I can parse finish parsing by recursive call of parser.parseSource(), but it's very inconvenient

Can we get this fixed, please?

feat: parse inline object types

Related to #79

while parsing property of type Object (e.g. { myProperty: { innerPropery: string } }, the type is not fully parsed and returns values like
{\n email: string\n }

An in-range update of @types/node is breaking the build 🚨

Version 10.5.4 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 10.5.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).
  • βœ… continuous-integration/travis-ci/push: The Travis CI build passed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ts-jest is breaking the build 🚨

The devDependency ts-jest was updated from 23.1.4 to 23.10.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build failed (Details).
  • ❌ continuous-integration/appveyor/branch: AppVeyor build failed (Details).

Release Notes for 23.10.0

ts-jest, reloaded!

  • lots of new features including full type-checking and internal cache (see changelog)
  • improved performances
  • Babel not required anymore
  • improved (and growing) documentation
  • a ts-jest Slack community where you can find some instant help
  • end-to-end isolated testing over multiple jest, typescript and babel versions
Commits

The new version differs by 293 commits.

  • 0e5ffed chore(release): 23.10.0
  • 3665609 Merge pull request #734 from huafu/appveyor-optimizations
  • 45d44d1 Merge branch 'master' into appveyor-optimizations
  • 76e2fe5 ci(appveyor): cache npm versions as well
  • 191c464 ci(appveyor): try to improve appveyor's config
  • 0f31b42 Merge pull request #733 from huafu/fix-test-snap
  • 661853a Merge branch 'master' into fix-test-snap
  • aa7458a Merge pull request #731 from kulshekhar/dependabot/npm_and_yarn/tslint-plugin-prettier-2.0.0
  • 70775f1 ci(lint): run lint scripts in series instead of parallel
  • a18e919 style(fix): exclude package.json from tslint rules
  • 011b580 test(config): stop using snapshots for pkg versions
  • 7e5a3a1 build(deps-dev): bump tslint-plugin-prettier from 1.3.0 to 2.0.0
  • fbe90a9 Merge pull request #730 from kulshekhar/dependabot/npm_and_yarn/@types/node-10.10.1
  • a88456e build(deps-dev): bump @types/node from 10.9.4 to 10.10.1
  • 54fd239 Merge pull request #729 from kulshekhar/dependabot/npm_and_yarn/prettier-1.14.3

There are 250 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

feat: parse "return" statements in methods and functions

I consider it necessary to be able to get all the return statements parsed.

For example, to add a returns property to the CallableDeclaration. So when you get this declaration, you would be able to iterate over the returns and also see the types of the statements that are returned (a function call, or a variable, or a constant, etc).

WDYTAT? This ability does not contradict the idea of the node-typescript-parser?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.