microsoft / microsoft/TypeScript

Consider .node files as module

Open
#41,739 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Search Terms

native module, node js native module, .node files

Suggestion

Here is the snippet that load the module:

import Aboukara from "../../AboukaraLib";
const combo_regex = /\w+@\w+\.[a-zA-Z]+:.+/gm;

Currently when I import a .node file the compiler throw me this error:

[6:13:25 PM] File change detected. Starting incremental compilation...

src/utils/findCombo.ts:1:22 - error TS2307: Cannot find module '../../AboukaraLib' or its corresponding type declarations.

1 import Aboukara from "../../AboukaraLib";
                       ~~~~~~~~~~~~~~~~~~~

[6:13:25 PM] Found 1 error. Watching for file changes.

If the compiler would be able to understand it it would make it useful for people who use native module.

Use Cases

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation file, test, or entry point is named; begin by tracing module resolution for the import shown in the issue and reviewing existing tests for native module extensions. Done should mean the compiler accepts imports of .node files without the reported TS2307 error, with behavior covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.