Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Plugin type error after updating Elysia version #29

@tnraro

Description

@tnraro

I would like to report that I'm experiencing a type error after updating to version 0.3.2.
I have tested the packages @elysiajs/cookie, @elysiajs/static, and @elysiajs/swagger.

import { cookie } from "@elysiajs/cookie";
import { staticPlugin } from "@elysiajs/static";
import { swagger } from "@elysiajs/swagger";
import { Elysia } from "elysia";

new Elysia()
  .use(staticPlugin())
  .use(cookie())
  .use(swagger())

Each plugins has type error like this:

Argument of type 'Promise<(app: Elysia<ElysiaInstance<{ store: Record<string, unknown>; request: {}; schema: {}; meta: Record<unique symbol, {}> & Record<unique symbol, {}> & Record<unique symbol, {}>; }>>) => Elysia<...>>' is not assignable to parameter of type 'Promise<{ default: (elysia: Elysia<any>) => MaybePromise<Elysia<never>>; }> | MaybePromise<(app: Elysia<ElysiaInstance<{ store: Record<string, unknown>; request: {}; schema: {}; meta: Record<...> & ... 1 more ... & Record<...>; }>>) => MaybePromise<...>>'.
  Type 'Promise<(app: Elysia<ElysiaInstance<{ store: Record<string, unknown>; request: {}; schema: {}; meta: Record<unique symbol, {}> & Record<unique symbol, {}> & Record<unique symbol, {}>; }>>) => Elysia<...>>' is not assignable to type 'Promise<{ default: (elysia: Elysia<any>) => MaybePromise<Elysia<never>>; }>'.
    Type '(app: Elysia<ElysiaInstance<{ store: Record<string, unknown>; request: {}; schema: {}; meta: Record<unique symbol, {}> & Record<unique symbol, {}> & Record<unique symbol, {}>; }>>) => Elysia<...>' is not assignable to type '{ default: (elysia: Elysia<any>) => MaybePromise<Elysia<never>>; }'.

Additionally, I have encountered a runtime issue with @elysiajs/swagger.

31 | const typebox_1 = require("../typebox");
32 | const index_1 = require("../custom/index");
33 | const index_2 = require("../format/index");
34 | class TypeSystemDuplicateTypeKind extends Error {
35 |     constructor(kind) {
36 |         super(`Duplicate kind '${kind}' detected`);
            ^
error: Duplicate kind 'File' detected
      at new TypeSystemDuplicateTypeKind (/node_modules/@sinclair/typebox/system/system.js:36:8)
      at CreateType (/node_modules/@sinclair/typebox/system/system.js:56:18)
      at /node_modules/elysia/dist/custom-types.js:1:1031
      at /node_modules/elysia/dist/index.js:1:9516

For your reference, the tested package versions are as follows:

elysia: 0.3.2
@elysiajs/cookie: 0.3.0
@elysiajs/static: 0.3.2
@elysiajs/swagger: 0.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions