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

TS2370: A rest parameter must be of an array type. #972

Open
monaxat opened this issue Apr 6, 2025 · 0 comments
Open

TS2370: A rest parameter must be of an array type. #972

monaxat opened this issue Apr 6, 2025 · 0 comments

Comments

@monaxat
Copy link

monaxat commented Apr 6, 2025

Hi! 👋

Firstly, thanks for your work on this project! 🙂

I'm trying to use animejs v4.0.0 in my Angular project.
Has got this error:

X [ERROR] TS2370: A rest parameter must be of an array type. [plugin angular-compiler]

    node_modules/animejs/types/index.d.ts:253:24:
      253 │ ...ort let linear: (...args?: (string | number)[]) => EasingFunct...
          ╵                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
"@angular/core": "^19.0.0",
"typescript": "~5.8.2"
"animejs": "^4.0.0",

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "strict": true,
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2022",
    "module": "es2020",
    "lib": [
      "es2018",
      "es2020",
      "dom"
    ],
    "useDefineForClassFields": false
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}

tsconfig.app.json

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": ["node"]
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

Here is the diff that solved my problem:

diff --git a/node_modules/animejs/types/index.d.ts b/node_modules/animejs/types/index.d.ts
index d00bc90..be37404 100644
--- a/node_modules/animejs/types/index.d.ts
+++ b/node_modules/animejs/types/index.d.ts
@@ -250,7 +250,7 @@ declare class Timeline extends Timer {
 declare function createTimeline(parameters?: TimelineParams): Timeline;
 type TimePosition = number | string | Function;
 declare namespace eases {
-    export let linear: (...args?: (string | number)[]) => EasingFunction;
+    export let linear: (...args: (string | number)[]) => EasingFunction;
     export let irregular: (length?: number, randomness?: number) => EasingFunction;
     export let steps: (steps?: number, fromStart?: boolean) => EasingFunction;
     export let cubicBezier: (mX1?: number, mY1?: number, mX2?: number, mY2?: number) => EasingFunction;

This issue body was partially generated by patch-package.

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

1 participant