question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typescript: error TS2315: Type 'Plugin' is not generic

See original GitHub issue

Similar issue: https://github.com/nuxt/vercel-builder/issues/28. I updated my project to Typescript and now I’m getting errors during the build on Vercel:

10:38:16.682 | node_modules_dev/@nuxt/types/config/build.d.ts(125,58): error TS2315: Type 'Plugin' is not generic.
-- | --
10:38:16.683 | node_modules_dev/@nuxt/types/config/build.d.ts(125,98): error TS2315: Type 'Plugin' is not generic.
10:38:16.683 | node_modules_dev/@nuxt/types/config/build.d.ts(125,134): error TS2315: Type 'Plugin' is not generic.
10:38:16.683 | node_modules_dev/@nuxt/types/config/build.d.ts(134,36): error TS2315: Type 'Plugin' is not generic.
10:38:16.683 | node_modules_dev/@nuxt/types/config/build.d.ts(135,37): error TS2315: Type 'Plugin' is not generic.
10:38:16.703 | Error: Command failed with exit code 2: npx tsc --target ES2018 --module ESNext --moduleResolution Node --lib ESNext,ESNext.AsyncIterable,DOM --esModuleInterop true --allowJs true --sourceMap true --strict true --experimentalDecorators true --baseUrl . --types @nuxt/types,@types/node,nuxt-i18n,@nuxtjs/strapi,@nuxtjs/toast --noEmit false --rootDir /vercel/workpath0 --outDir now_compiled nuxt.config.ts
10:38:16.703 | at makeError (/vercel/b3a3026e4d524981/.build-utils/.builder/node_modules/execa/lib/error.js:59:11)
-- | --
10:38:16.704 | at handlePromise (/vercel/b3a3026e4d524981/.build-utils/.builder/node_modules/execa/index.js:114:26)
10:38:16.704 | at processTicksAndRejections (internal/process/task_queues.js:97:5)
10:38:16.704 | at async compileTypescriptBuildFiles (/vercel/b3a3026e4d524981/.build-utils/.builder/node_modules/@nuxtjs/vercel-builder/lib/index.js:220:3)
10:38:16.704 | at async Object.build (/vercel/b3a3026e4d524981/.build-utils/.builder/node_modules/@nuxtjs/vercel-builder/lib/index.js:333:31)
10:38:16.704 | at async buildStep (/var/task/sandbox-worker.js:116543:24)
10:38:16.704 | at async /var/task/sandbox-worker.js:116190:27 {

I’m using nuxt 2.15.4, so I don’t have @nuxt/typescript-runtime installed. Here are my files:

vercel.json

{
  "version": 2,
  "builds": [
    {
      "src": "api/**/*.ts",
      "use": "@vercel/node"
    },
    {
      "src": "nuxt.config.ts",
      "use": "@nuxtjs/vercel-builder",
      "config": {
        "serverFiles": ["lang/**"]
      }
    }
  ]
}

nuxt.config.ts

import { NuxtConfig } from "@nuxt/types";
import localesFetcher from "./lang/localesFetcher";

const config: NuxtConfig = async () => {
  const locales = await localesFetcher();
  return {
    head: {},
    plugins: [
      "~/plugins/vue-clipboard2.ts",
      "~/plugins/vue-country-flag.ts",
      "~/plugins/i18n.ts"
    ],
    components: true,
    loading: false,
    build: {
      loaders: {
        limit: 0
      }
    },
    buildModules: [
      "@nuxt/typescript-build",
      "@nuxtjs/tailwindcss",
      "@teamnovu/nuxt-breaky"
    ],
    modules: [
      "nuxt-i18n",
      "@nuxtjs/strapi",
      "@nuxtjs/toast",
      "@nuxtjs/google-fonts"
    ],
    i18n: {
      baseUrl: process.env.BASE_URL || "http://localhost:3000",
      strategy: "prefix",
      locales,
      lazy: true,
      langDir: "lang/",
      defaultLocale: "en",
      vueI18n: {
        fallbackLocale: "en"
      },
      detectBrowserLanguage: {
        useCookie: true,
        cookieKey: "i18n_redirected",
        onlyOnRoot: true
      }
    },
    strapi: {},
    toast: {
      position: "top-center",
      duration: 1000,
      theme: "tw"
    },
    tailwindcss: {
      jit: true,
      exposeConfig: true,
      viewer: false
    },
    googleFonts: {
      families: {
        Poppins: [100, 200, 300, 400, 500, 600, 700, 800, 900]
      }
    }
  };
};

export default config;

package.json

{
  "name": "nuxt",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build --modern",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "analyze": "yarn build -a",
    "vercel": "vercel dev"
  },
  "dependencies": {
    "@nuxtjs/strapi": "^0.3.1",
    "@nuxtjs/toast": "^3.3.1",
    "@nuxtjs/vercel-builder": "^0.21.2",
    "@vercel/node": "^1.10.0",
    "axios": "^0.21.1",
    "core-js": "^3.10.1",
    "nuxt": "^2.15.4",
    "nuxt-i18n": "^6.25.0",
    "nuxt-property-decorator": "^2.9.1",
    "vue-clipboard2": "^0.3.1",
    "vue-country-flag": "^2.0.4"
  },
  "devDependencies": {
    "@nuxt/types": "^2.15.3",
    "@nuxt/typescript-build": "^2.1.0",
    "@nuxtjs/google-fonts": "^1.2.0",
    "@nuxtjs/tailwindcss": "^4.0.3",
    "@teamnovu/nuxt-breaky": "^1.2.2",
    "postcss": "^8.2.10",
    "tailwind-stroke-color": "1.0.0",
    "tailwindcss": "^2.1.1",
    "tailwindcss-textshadow": "^2.1.3",
    "vuex-module-decorators": "^1.0.1"
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
danielroecommented, Apr 23, 2021

@florian-lefebvre Any chance you could create a reproduction?

You might also try enabling skipLibCheck in your tsconfig.json - see docs.

1reaction
florian-lefebvrecommented, Apr 23, 2021

Thanks, I’ll check that. I’ll create a repo and send the link here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error TS2315: Type 'ElementRef' is not generic - Stack Overflow
ts(55,18): error TS2315: Type 'ElementRef' is not generic. This does not seem to be a common problem, does anyone have any idea how...
Read more >
Why does TS say the type is not generic when it in fact is?
Why does Webstorm tell me in one breath that the type is both generic and not generic? I'm confused about this error. TS...
Read more >
ProseMirror is now a TypeScript project - Announce
We are trying to upgrade to use the new Prosemirror types and although our type checker basically exploded, the experience has been really...
Read more >
Documentation - Generics - TypeScript
When we do, the compiler will give us an error that we're using the .length ... The type of generic functions is just...
Read more >
TypeScript errors and how to fix them
error TS2315 : Type ' CustomRequest ' is not generic. Broken Code ❌. 1 2 3 4 5
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found