tree-sitter-typescript not working with my tree-sitter library in javascript

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 path = require('path');
const Parser  = require('tree-sitter');
const Typescript= require('tree-sitter-typescript').typescript;

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