0

Recently I researched in this site about importing an javascript node module into angular. But from there I have a big question about it.

Is it possible to see the functions, variables, interfaces (if it has) from the imported javascript package into my angular project?

For this great example I want to see all content from @adonisjs/websocket-client

// app.component.ts import Ws from '@adonisjs/websocket-client' const ws = Ws('ws://localhost:3333')

Using my variable ws to see all properties and functions but nothing appears. But when it's about a javascript framework it works 100%, I mean you have all definitions.

1 Answers1

0

You will need a type definition for that javascript module to be able to do that. Have a look at : The repository for high quality TypeScript type definitions

PankajH
  • 160
  • 1
  • 9
  • But that works in a single javascript file and the package mentioned above has some index.js – Hector Miguel Soto Jun 15 '19 at 05:02
  • you will either have to generate them your selfs or use a library which has then in place. https://stackoverflow.com/questions/18301898/generating-typescript-declaration-files-from-javascript – PankajH Jun 15 '19 at 05:08
  • also https://stackoverflow.com/questions/12687779/how-do-you-produce-a-d-ts-typings-definition-file-from-an-existing-javascript – PankajH Jun 15 '19 at 05:10