No overload matches this call
warcayac opened this issue · comments
What version of Elysia.JS is running?
1.1.4
What platform is your computer?
Linux 6.9.10-zen1-1-zen x86_64 unknown
What steps can reproduce the bug?
In my Elysia projects I use my custom plugins, and when Bun/Elysia releases an update then I need to update my projects and plugins by running bun update
because VS Code shows errors like "No overload matches this call" and "This expression is not callable" on my main project around statements related to my custom plugins, so updating my plugins resolves this problem.
After weeks of inactivity I updated Bun/Elysia then updated my plugins but those error messages like "No overload matches this call" and "This expression is not callable" persist. To determine where the problem is originated I commented almost all of the plugin code but the problem continues to persist, so apparently the problem is not with my plugins but with the Elysia update.
Basic project
package.json
{
"name": "htmx_finance_app_3",
"version": "1.0.50",
"module": "src/index.tsx",
"dependencies": {
"@elysiajs/cors": "^1.1.0",
"@elysiajs/html": "^1.1.0",
"@elysiajs/static": "^1.1.0",
"elysia": "1.1.4",
"wac-core": "link:wac-core",
"wac-elysia": "link:wac-elysia"
},
"scripts": {
"test": "NODE_ENV=test bun test ./test/**.test.tsx",
"dev": "NODE_ENV=development bun --env-file=.env run --watch src/index.tsx",
"start": "NODE_ENV=production bun --env-file=.env run src/index.tsx"
},
"devDependencies": {
"@types/bun": "^1.1.6"
}
}
tsconfig.json
{
"compilerOptions": {
/* Language and Environment */
"target": "ES2022",
"lib": [],
"moduleDetection": "force",
"jsx": "react",
"jsxFactory": "Html.createElement",
"jsxFragmentFactory": "Html.Fragment",
/* Modules */
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
/* JavaScript Support */
"allowJs": true,
/* Emit */
"noEmit": true,
"declaration": true,
/* Interop Constraints */
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
/* Type Checking */
"strict": true,
"noUncheckedIndexedAccess": true,
/* Completeness */
"skipLibCheck": true
},
"exclude": ["node_modules"]
}
src/index.tsx
import Elysia from "elysia";
import cors from "@elysiajs/cors";
import { html } from "@elysiajs/html";
import staticPlugin from "@elysiajs/static";
import { errorHandler, httpResponse, wlogger } from "wac-elysia";
export const app = new Elysia();
app
.use(cors({methods: '*'}))
.use(html())
.use(staticPlugin())
.use(wlogger(true))
.use(errorHandler())
.get('/', () => "Hello Elysia")
.all('*', () => httpResponse[404]('Path name not found'))
.listen(
process.env.PORT || 3001,
() => console.log(`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`)
)
;
Plugin code: wac-elysia
package.json
{
"name": "wac-elysia",
"version": "0.0.2",
"module": "index.ts",
"type": "module",
"devDependencies": {
"@types/bun": "^1.1.6"
},
"peerDependencies": {
"typescript": "^5.4.3"
},
"dependencies": {
"ansis": "^3.3.2",
"elysia": "^1.1.4",
"wac-core": "link:wac-core"
}
}
tsconfig.json
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}
src/wlogger/index.ts
import Elysia from "elysia";
import WInfo from './WInfo';
import type { TJMap } from "wac-core";
export const wlogger = (showBody: boolean = false, showLog: boolean = true) => new Elysia()
;
index.ts
export * from './src/const'
export * from './src/wlogger'
export * from './src/error-handler'
What is the expected behavior?
No error messages
What do you see instead?
Placing the cursor on wlogger, the error details are as follows:
No overload matches this call.
The last overload gave the following error.
Argument of type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: {}; error: {}; }, { schema: {}; macro: {}; macroFn: {}; }, {}, { derive: {}; resolve: {}; schema: {}; }, { derive: {}; resolve: {}; schema: {}; }>' is not assignable to parameter of type 'Promise<{ default: AnyElysia; }>'.
Type 'Elysia<"", false, { decorator: {}; store: {}; derive: {}; resolve: {}; }, { type: {}; error: {}; }, { schema: {}; macro: {}; macroFn: {}; }, {}, { derive: {}; resolve: {}; schema: {}; }, { derive: {}; resolve: {}; schema: {}; }>' is missing the following properties from type 'Promise<{ default: AnyElysia; }>': then, catch, finally, [Symbol.toStringTag]ts(2769)
index.d.ts(884, 5): The last overload is declared here.
⚠ Error (TS2769) |
No overload matches this call.
The last overload gave the following error.
Argument of type:
is not assignable to parameter of type
.
Type:
is missing the following properties from type
:
then
catch
finally
[Symbol.toStringTag]
(alias) wlogger(showBody?: boolean, showLog?: boolean): Elysia<"", false, {
decorator: {};
store: {};
derive: {};
resolve: {};
}, {
type: {};
error: {};
}, {
schema: {};
macro: {};
macroFn: {};
}, {}, {
derive: {};
resolve: {};
schema: {};
}, {
...;
}>
import wlogger
Additional information
No response
Have you try deleting node_modules, bun.lockb and try again yet?
Yes, I did that but the problem persists.
Have you try deleting node_modules, bun.lockb and try again yet?
Deleting the node_modules
and running bun install
resolved this for me. 🤔
I think this error is related to Elysia version because recently I updated it to 1.1.5 and all is working as expected again.