PassionateDeveloper
PassionateDeveloper

Reputation: 15138

How to add typings support to vs code and the tsc command if the module dont use @types?

I am using the module "Rhea" (https://www.npmjs.com/package/rhea) which has the typings for typescript in their own /typings folder (so /node_modules/rhea/typings) of the module instead of delivering a @types module I can install by NPM.

I include the project like

var container = require('rhea');

which works fine, but container is any here.

What do I have todo that

  1. VS COde will give me typescript intellisense for these Typings
  2. the Tsc command will check the typings when executed?

Upvotes: 1

Views: 100

Answers (1)

rhea just does not have typings for default export. If you need container type, you can just :

import container, { Container } from 'rhea'

OR

import type { Container } from 'rhea'

Please see all available types here

As you saw, there are no default export, only exports.

For instance, if you want to use Message type, you can import it:

import { Message } from 'rhea'

Upvotes: 1

Related Questions