arethetypeswrong / arethetypeswrong.github.io

Tool for analyzing TypeScript types of npm packages

Home Page:https://arethetypeswrong.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect fallback bug detection

emmatown opened this issue · comments

For a package like this:

// package.json
{
  "name": "some-pkg",
  "version": "0.0.0",
  "exports": {
    ".": {
      "import": {},
      "require": {},
      "default": "./index.js"
    }
  }
}
// index.js
console.log('a')
// index.d.ts
export {};

Importing it works in Node (and TypeScript) but arethetypeswrong reports that it's relying on microsoft/TypeScript#50762 when it's not since TypeScript is doing the correct thing in this case and working like Node.

(of course it makes no sense to do what's in the example, it's just to illustrate the problem)

Do you know of a published package where this happens?

I don't unfortunately, sorry

Some context as to how I ran into this though in case it's helpful: I was suggesting in a PR review that this line: https://github.com/emotion-js/emotion/blob/fef1ea086fbec998caaa016a5ecdace4bbb9d749/packages/react/package.json#L51 was unnecessary but ended up deciding not to remove it to avoid arethetypeswrong saying that it was wrong.

(I'm aware that what that entry point is doing is bad in a sense since it's lying to TypeScript but that's kind of the whole point of what's going on there because it's for https://github.com/kentcdodds/babel-plugin-macros and even ignoring module stuff, it wants to lie about what's going on)