Vincit / objection.js

An SQL-friendly ORM for Node.js
https://vincit.github.io/objection.js
MIT License
7.24k stars 636 forks source link

coc-tsserver throws error when using Objection Model class on typescript v4.6.0 and above #2294

Closed axmad386 closed 1 year ago

axmad386 commented 2 years ago

Which objection version are you using? "objection": "^3.0.1", "knex": "^2.1.0"

What are you doing? I just create class that extends Objection Model, and add some property to that class

What is happening? Errors just show up in just after I type some character. This is not happen in regular class.

note: I use neovim + coc:ts-server. This issue is not showed up on vscode.

What are you expecting to happen instead? No errors is throwing from ts-server.

Example code to reproduce the issue

import {Model} from 'objection';

class A extends Model {
 // whenever i type something here, errors is thrown.
}

My Question is... Is this problem related to objection? Or coc:ts-server? Because this issue is not occured on regular class. For example I write this

abstract class A {}
class B extends A {
  something!: string;

  static doSomething(){
  }
}

Above example code is fine.

This is full log

## versions

vim version: NVIM v0.7.2
node version: v17.4.0
coc.nvim version: 0.0.81-2522eee5 2022-06-14 19:03:29 +0800
coc.nvim directory: /home/dmuggle/.vim/plugged/coc.nvim
term: xterm-256color
platform: linux

## Log of coc.nvim

2022-07-08T09:16:18.703 INFO (pid:176633) [services] - registered service "eslint"
2022-07-08T09:16:18.705 INFO (pid:176633) [services] - ESLint state change: stopped => starting
2022-07-08T09:16:18.730 INFO (pid:176633) [coc-git] - Looking for git in: git
2022-07-08T09:16:19.075 INFO (pid:176633) [services] - registered service "tsserver"
2022-07-08T09:16:19.093 INFO (pid:176633) [plugin] - coc.nvim initialized with node: v17.4.0 after 530ms
2022-07-08T09:16:19.123 INFO (pid:176633) [services] - service tsserver started
2022-07-08T09:16:19.311 INFO (pid:176633) [services] - ESLint state change: starting => running
2022-07-08T09:16:19.319 INFO (pid:176633) [services] - service eslint started
2022-07-08T09:16:23.751 ERROR (pid:176633) [node-client] - Error: Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at Object.setTextPos (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:12103:22)
    at Object.skipToEndOf (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:145431:25)
    at processChildNodes (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146926:47)
    at /home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146843:21
    at visitNodes (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:30474:24)
    at Object.forEachChild (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:30665:21)
    at processNode (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146840:20)
    at processChildNode (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146911:21)
    at processChildNodes (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146965:48)
    at /home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146843:21
    at visitNodes (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:30474:24)
    at Object.forEachChild (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:30653:24)
    at processNode (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146840:20)
    at processChildNode (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146911:21)
    at /home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146841:21
    at visitNode (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:30469:24)
    at Object.forEachChild (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:30628:21)
    at processNode (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146840:20)
    at formatSpanWorker (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146640:17)
    at /home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146603:140
    at Object.getFormattingScanner (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:145230:23)
    at Object.formatNodeGivenIndentation (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:146603:31)
    at /home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:132267:42
    at Object.flatMap (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:508:25)
    at Object.printAndFormatSnippetList (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:132265:34)
    at getEntryForMemberCompletion (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:132067:42)
    at createCompletionEntry (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:131887:23)
    at getCompletionEntriesFromSymbols (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:132394:29)
    at completionInfoFromData (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:131703:17)
    at Object.getCompletionsAtPosition (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:131558:36)
    at Object.getCompletionsAtPosition (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:164640:35)
    at IOSession.Session.getCompletions (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:176440:64)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:175115:61)
    at /home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:177172:88
    at IOSession.Session.executeWithRequestId (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:177163:28)
    at IOSession.Session.executeCommand (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:177172:33)
    at IOSession.Session.onMessage (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:177198:35)
    at Interface.<anonymous> (/home/dmuggle/GIT/lunox-framework/node_modules/.pnpm/typescript@4.7.3/node_modules/typescript/lib/tsserver.js:179803:31)
    at Interface.emit (node:events:520:28)
    at Interface.[_onLine] [as _onLine] (node:internal/readline/interface:389:12)
    at Interface.[_normalWrite] [as _normalWrite] (node:internal/readline/interface:574:59)
    at Socket.ondata (node:internal/readline/interface:219:23)
    at Socket.emit (node:events:520:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.Readable.push (node:internal/streams/readable:234:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) Error
    at HM.echoError (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:35:1869)
    at MD.completeSource (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:277:33427)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async MD.completeSources (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:277:32178)
    at async MD.doComplete (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:277:31649)
    at async bte.startCompletion (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:277:43393)
    at async bte.triggerCompletion (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:277:47168)
    at async bte.onTextChangedI (/home/dmuggle/.vim/plugged/coc.nvim/build/index.js:277:45898)
2022-07-08T09:16:23.752 ERROR (pid:176633) [completion-complete] - Complete error: tsc-typescript Error: Error processing request. Debug Failure. False expression.
axmad386 commented 2 years ago

Update: This error only occur for typescript version above ^v4.6.0. I tested in typescript@~v4.50 is fine.

lehni commented 1 year ago

Do you still have this problem on 3.0.2?

axmad386 commented 1 year ago

Now I switch to native LSP instead of coc. It's working fine on latest typescript. I don't testing in coc yet, but I think is working now. I will close this issue.