Skip to content

bug: tree-sitter-typescript not working with my tree-sitter library in javascript #292

Closed
@precious112

Description

@precious112

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-typescript

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

I have been trying to get tree-sitter-typescript to work in javascript but i's not working always throwing the error Invalid language object but tree-sitter works well with tree-sitter-javascript and tree-sitter-python. here's my code :

const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

const parser= new Parser();
parser.setLanguage(Typescript);```

### Steps To Reproduce/Bad Parse Tree

```const path = require('path');
const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

const parser= new Parser();
parser.setLanguage(Typescript);```

### Expected Behavior/Parse Tree

```const path = require('path');
const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

const parser= new Parser();
parser.setLanguage(Typescript);```

### Repro

```TypeScript
// Example code that causes the issue
function foo() {
  // Code that fails to parse, or causes an error
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions