Cannot find module '@nut-tree/element-inspector/win' or its corresponding type declarations
wooogler opened this issue · 1 comments
Version
@nut-tree/element-inspector: 0.1.5
Short overview
Attempting to import and use the elements module from @nut-tree/element-inspector/win results in a "Cannot find module" error
Issue occurs on
- Virtual machine
- Docker container
- Dev/Host system
node version:
20.14.0
OS type and version:
Windows 11 Pro
Detailed error description
Of course, I purchased a solo plan for nutjs.
When attempting to use the elements module from @nut-tree/element-inspector/win, I encounter the following issues:
TypeScript reports: Cannot find module '@nut-tree/element-inspector/win' or its corresponding type declarations.ts(2307)
These errors occur despite following the module's documentation and correctly importing the module. It appears that TypeScript cannot locate the module or its type declarations, and also raises a warning about the usage of elements.
Full code sample to reproduce
Exact same with this tutorial
import {
useConsoleLogger,
ConsoleLogLevel,
screen,
windowWithTitle,
mouse,
Button,
straightTo,
centerOf,
} from "@nut-tree/nut-js";
import { useBolt } from "@nut-tree/bolt";
import "@nut-tree/element-inspector";
import { elements } from "@nut-tree/element-inspector/win";
useConsoleLogger({ logLevel: ConsoleLogLevel.DEBUG });
useBolt();
async function main() {
const vs = await screen.find(windowWithTitle(/Visual Studio Code/));
await vs.focus();
// We can configure the max depths of the search tree
// const items = await vs.getElements(); // <== By default, it will search through up to 100 levels deep
const items = await vs.getElements(); // <== This will search 5 levels deep
console.log(JSON.stringify(items, null, 2));
const fileMenu = await vs.find(elements.menuItem({ title: "File" }));
if (fileMenu.region != null) {
await screen.highlight(fileMenu.region);
await mouse.move(straightTo(centerOf(fileMenu.region)));
await mouse.click(Button.LEFT);
}
}
main();
Additional content
Please provide any (mandatory) additional data to reproduce the error (Dockerfiles etc.)