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

Typescript definition is broken #712

Closed
KromDaniel opened this issue Oct 3, 2018 · 6 comments
Closed

Typescript definition is broken #712

KromDaniel opened this issue Oct 3, 2018 · 6 comments

Comments

@KromDaniel
Copy link

Hey

  • Typescript 3.0.3
  • ioredis 4.0.0

Typescript definition throws an error not matter what combination of import I'm trying

import * as Redis from "ioredis";
const redis = new Redis();

error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.

When trying

import Redis from "ioredis";
const redis = new Redis();

Getting the error

TS1192: Module '"node_modules/@types/ioredis/index"' has no default export.

Any ideas?
thanks!

@luin
Copy link
Collaborator

luin commented Oct 3, 2018

Would you try to upgrade @types/ioredis package to see whether the problem still exists? The package is located in another repo: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/8fb0189dd4432b854d72d9e78fcdea53829b24fe/types/ioredis/index.d.ts.

@KromDaniel
Copy link
Author

@luin thanks, unfortunately I'm up to-date

// Type definitions for ioredis 4.0
// Project: https://github.com/luin/ioredis
// Definitions by: York Yao <https://github.com/plantain-00>
//                 Christopher Eck <https://github.com/chrisleck>
//                 Yoga Aliarham <https://github.com/aliarham11>
//                 Ebrahim <https://github.com/br8h>
//                 Shahar Mor <https://github.com/shaharmor>
//                 Whemoon Jang <https://github.com/palindrom615>
//                 Francis Gulotta <https://github.com/reconbot>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

/* =================== USAGE ===================
    import * as Redis from "ioredis";
    const redis = new Redis();
 =============================================== */

@luin
Copy link
Collaborator

luin commented Oct 6, 2018

Not sure where the problem is. Here's my setup:

@types/ioredis: 4.0.3
ioredis: 4.0.0

image

@KromDaniel
Copy link
Author

KromDaniel commented Oct 6, 2018 via email

@luin
Copy link
Collaborator

luin commented Oct 6, 2018

Tested with 3.0.3 & 3.1.1

@KromDaniel
Copy link
Author

It seems that the tsconfig.json file didn't have the key allowSyntheticDefaultImports set for true, now it's fixed

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

3 participants
@luin @KromDaniel and others