Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript error with module esnext and moduleResolution bundler. #2770

Open
mousseq opened this issue Apr 2, 2024 · 1 comment
Open

Typescript error with module esnext and moduleResolution bundler. #2770

mousseq opened this issue Apr 2, 2024 · 1 comment

Comments

@mousseq
Copy link

mousseq commented Apr 2, 2024

SerialPort Version

12.0.0

Node Version

20.2

Electron Version

No response

Platform

Linux pi4-1r 6.6.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux

Architecture

ARM

Hardware or chipset of serialport

FTDI

What steps will reproduce the bug?

tsconfig.json contains:
module: "esnext"
moduleResolution: "bundler"

File sp.ts:
import { SerialPort } from "serialport";

let port = new SerialPort(
{
path: "foobar",
baudRate: 115200
}
);

Transpile with tsc and get:

What happens?

$ ./node_modules/typescript/bin/tsc
node_modules/@serialport/bindings-cpp/dist/darwin.d.ts:2:10 - error TS2305: Module '"."' has no exported member 'BindingPortInterface'.

2 import { BindingPortInterface } from '.';
~~~~~~~~~~~~~~~~~~~~

node_modules/@serialport/bindings-cpp/dist/linux.d.ts:4:10 - error TS2305: Module '"."' has no exported member 'BindingPortInterface'.

4 import { BindingPortInterface } from '.';
~~~~~~~~~~~~~~~~~~~~

node_modules/@serialport/bindings-cpp/dist/win32.d.ts:2:10 - error TS2305: Module '"."' has no exported member 'BindingPortInterface'.

2 import { BindingPortInterface } from '.';
~~~~~~~~~~~~~~~~~~~~

node_modules/serialport/dist/serialport.d.ts:2:27 - error TS2305: Module '"@serialport/bindings-cpp"' has no exported member 'OpenOptionsFromBinding'.

2 import { AutoDetectTypes, OpenOptionsFromBinding } from '@serialport/bindings-cpp';
~~~~~~~~~~~~~~~~~~~~~~

Found 4 errors in 4 files.

Errors Files
1 node_modules/@serialport/bindings-cpp/dist/darwin.d.ts:2
1 node_modules/@serialport/bindings-cpp/dist/linux.d.ts:4
1 node_modules/@serialport/bindings-cpp/dist/win32.d.ts:2
1 node_modules/serialport/dist/serialport.d.ts:2

What should have happened?

Transpilation should have succeeded.

Additional information

Either of these configurations works:
"module": "esnext"
"moduleResolution": "node"
or
"module": "nodenext"
"moduleResolution": "nodenext"

@AlmTalal
Copy link

AlmTalal commented May 8, 2024

Did you solved this ? Please save me jajaj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants