idle.ts icon indicating copy to clipboard operation
idle.ts copied to clipboard

Cannot import in vscode

Open ReallyNotARussianSpy opened this issue 6 years ago • 1 comments

I'm not sure if I'm missing something but I'm not able to import this into my Angular project using VSCode

import { Idle } from 'idle.ts'; [ts] An import path cannot end with a '.ts' extension. Consider importing 'idle' instead.

import { Idle } from 'idle'; [ts] Cannot find module 'idle'.

ReallyNotARussianSpy avatar Oct 01 '18 13:10 ReallyNotARussianSpy

This might be a typescript bug that it is not restricting its rule to relative paths. But probably this package should just change its name because this is likely to cause all kinds of similar compatibility issues across the ecosystem.

I was able to give this package a package manager alias ("idle-ts": "npm:idle.ts@^1.0.3", in my package.json dependencies). I couldn't figure out how to get tsconfig.json paths aliasing to work for me.

But then, the package.json seems to me to be incorrect. This doesn't work, typescript can't find the type definitions:

    "main": "idle.js",

But if I manually hack this node_module folder's package.json, typescript is happy:

    "main": "./src/js/idle.js",

JasonKleban avatar Oct 19 '21 02:10 JasonKleban