Skip to content

Typescript error #92

Open
Open
@aarongreenwald

Description

@aarongreenwald

Starting today, apparently with the release of v1.1.0, we started getting the following error when running TS compilation on our project that uses lru-memoize:

node_modules/lru-memoize/dist/index.d.ts:1:25 - error TS1254: A 'const' initializer 
in an ambient context must be a string or numeric literal or literal enum reference.

  1 declare const memoize = (
                            ~
  2   limit?: number,
    ~~~~~~~~~~~~~~~~~
...
  4   deepObjects?: boolean
    ~~~~~~~~~~~~~~~~~~~~~~~
  5 ) => <T extends Function>(func: T) => T;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/lru-memoize/dist/index.d.ts:5:39 - error TS2693: 'T' only refers to a type, 
but is being used as a value here.

5 ) => <T extends Function>(func: T) => T;
                                        ~


Found 2 errors.

Our tsconfig.json looks like this:

{
  "compilerOptions": {
    "declaration": true,
    "allowJs": false,
    "target": "ESNEXT",
    "module": "commonjs",
    "noImplicitAny": false,
    "noImplicitThis": false,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "lib": ["es2015", "es2017.object"],
    "outDir": "./lib"
  },
  "exclude": [
    "node_modules",
    "dist",
    "test"
  ]
}

Any ideas what we're doing wrong? When I downgrade to version 1.0.2 of lru-memoize everything works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions