I have installed this dependency(js) in existing Angular(ts) project but you won't compile this code until if it's converted into ts. Then I found a ts supported repository that can manage your back support for typescript . But anyhow I am not able to import those dependency in my class
import { SerialPort } from '@types/serialport';
And throw an error node_modules/@types/serialport/index"' has no exported member 'SerialPort'.
So any other way can I import serialport object ? Please give a flag exactly where I am doing wrong. Your help would be highly appreciated. Thanks in advance.
Serialport type declarations are from DefinitelyTyped.
From the index.d.ts, it seems to declare a namespace.
Try:
import * as SerialPort from 'serialport';
NOTE: You directly import from serialport not from @types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With