Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop non-working default export for TypeScript users #89

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/index.ts
Expand Up @@ -385,5 +385,4 @@ Object.defineProperties(is, {
}
});

module.exports = is; // For CommonJS default export support
export default is;
export = is;
6 changes: 5 additions & 1 deletion test/test.ts
Expand Up @@ -7,11 +7,15 @@ import test, {ExecutionContext} from 'ava';
import {JSDOM} from 'jsdom';
import {Subject, Observable} from 'rxjs';
import ZenObservable from 'zen-observable';
import is, {TypeName} from '../source';

// eslint-disable-next-line @typescript-eslint/no-require-imports
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either import/default follows esModuleInterop and therefore allows import X from Y on CJS modules, or @typescript-eslint/no-require-imports should be disabled.

Since I have to disable a rule, I might as well leave the old ESM import and disable import/default on that line

import is = require('../source');

// eslint-disable-next-line @typescript-eslint/no-require-imports
const URLGlobal = typeof URL === 'undefined' ? require('url').URL : URL;

const {TypeName} = is;

const isNode10orHigher = Number(process.versions.node.split('.')[0]) >= 10;

class PromiseSubclassFixture<T> extends Promise<T> {}
Expand Down