Fix false positive of FalseExportDefault#67
Conversation
🦋 Changeset detectedLatest commit: c8993b9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Was this actually a false positive? TS imports with node16 The suggested fix provided appears to be a workaround for the exact issue that arethetypeswrong was previously flagging |
|
Yes, it is a false positive, because module.exports = exports = Ajv;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Ajv;This rule is supposed to flag when types declare a default export that isn’t present in the JS. But the “default export” is present here. That means ESM users can reliably do impor Ajv from "ajv";
const ajv = new Ajv.default();and the runtime and types agree. The problem that AJV has is a lesser one that the tool doesn’t yet catch, but would be a good addition. The types should ideally reflect that import Ajv from "ajv";
new Ajv();
new Ajv.default();which is the reality at runtime. Detecting this requires running the type checker, though. #10 is related. |

No description provided.