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

Lint error in typescript #13

Closed
nowrap opened this issue Sep 6, 2019 · 2 comments
Closed

Lint error in typescript #13

nowrap opened this issue Sep 6, 2019 · 2 comments

Comments

@nowrap
Copy link

nowrap commented Sep 6, 2019

Hello,
i am using sortKeys in a typescript project, but getting a lint error:
sortKeys({a: 0, b: 1});

Results in:

This expression is not callable.
Type '{ default: <T extends { [key: string]: any; }>(object: T, opt
ions?: Options | undefined) => T; }' has no call signatures.

The same result i am getting by using an object of type any:

    private generateParams(p: any, p1: string, p2: string): string {
        const sorted = sortKeys(p);

Regards
nowrap

@sindresorhus
Copy link
Owner

You are probably importing it incorrectly. Should be import sortKeys = require('sort-keys');.

@nowrap
Copy link
Author

nowrap commented Sep 6, 2019

import sortKeys from 'sort-keys';
solved it. Before i had import * as

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants