ruby/typeprof

Updating a Rails app to Ruby 3.1.2 breaks typrof

theasteve opened this issue · 1 comments

$ rails -v
Rails 6.1.6
stevenaguilar ~/portal on add-linux-platform[$]
$ ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]

I'm currently trying to upgrade a Rails app to use Ruby 3.1.2. When I try to deploy to heroku I get the following error:

remote:        ERROR in vendor/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/typeprof-0.21.2/vscode/src/extension.ts:3:25
remote:        TS2307: Cannot find module 'vscode' or its corresponding type declarations.

It seems that it comes from typeprof-0.21.2. Here is the full stack trace:

remote:           [0] ./node_modules/react/index.js 190 bytes {0} {1} [built]
remote:           [6] ./app/javascript/components/v2/App/Claims/ClaimDetails/ClaimStyles.tsx 16.8 KiB {0} {1} [built]
remote:           [9] ./app/javascript/components/v2/App/utils/index.ts + 2 modules 13.1 KiB {0} {1} [built]
remote:               | ./app/javascript/components/v2/App/utils/index.ts 9.34 KiB [built]
remote:               | ./node_modules/date-fns/esm/subMonths/index.js 1.17 KiB [built]
remote:               | ./node_modules/date-fns/esm/sub/index.js 2.53 KiB [built]
remote:          [12] ./app/javascript/components/v2/App/testUtils/Wrapper.tsx 795 bytes {0} {1} [built]
remote:          [13] ./app/javascript/components/v2/App/interfaces.ts 4.07 KiB {0} {1} [built]
remote:          [19] ./app/javascript/components/v2/App/utils/userRole.ts 1.57 KiB {0} {1} [built]
remote:          [20] ./app/javascript/components/v2/App/toast/use-toast.tsx 288 bytes {0} {1} [built]
remote:          [22] ./app/javascript/components/v2/App/Invitation/Styles.tsx 2.69 KiB {0} {1} [built]
remote:          [24] ./app/javascript/components/v2/App/utils/constants.ts 2.3 KiB {0} {1} [built]
remote:         [348] ./app/javascript/components/datatables/index.ts 837 bytes {0} {1} [built]
remote:         [647] ./app/javascript/components/modals/2fa_disable_modal.ts 1.52 KiB {0} {1} [built]
remote:         [828] ./app/javascript/components sync ^\.\/.*$ 38.2 KiB {0} {1} [built]
remote:        [1231] ./node_modules/react_ujs/react_ujs/index.js 5.89 KiB {0} {1} [built]
remote:        [1243] ./app/javascript/packs/application.ts 1.45 KiB {0} [built]
remote:        [1250] ./app/javascript/packs/server_rendering.ts 292 bytes {1} [built]
remote:            + 1528 hidden modules
remote:        
remote:        ERROR in vendor/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/typeprof-0.21.2/vscode/src/extension.ts:3:25
remote:        TS2307: Cannot find module 'vscode' or its corresponding type declarations.
remote:            1 | "use strict";
remote:            2 |
remote:          > 3 | import * as vscode from "vscode";
remote:              |                         ^^^^^^^^
remote:            4 | import {
remote:            5 |   LanguageClient,
remote:            6 |   LanguageClientOptions,
remote:        
remote:        ERROR in vendor/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/typeprof-0.21.2/vscode/src/extension.ts:8:8
remote:        TS2307: Cannot find module 'vscode-languageclient/node' or its corresponding type declarations.
remote:             6 |   LanguageClientOptions,
remote:             7 |   ServerOptions,
remote:          >  8 | } from "vscode-languageclient/node";
remote:               |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
remote:             9 | import * as net from "net";
remote:            10 | import * as child_process from "child_process";
remote:            11 | import { existsSync } from "fs";
remote:        
remote:        ERROR in vendor/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/typeprof-0.21.2/vscode/src/extension.ts:278:9
remote:        TS2571: Object is of type 'unknown'.
remote:            276 |
remote:            277 |   activeFolders.forEach((folder) => {
remote:          > 278 |     if (folder.uri.scheme === "file" && !clientSessions.has(folder)) {
remote:                |         ^^^^^^
remote:            279 |       startTypeProf(folder);
remote:            280 |     }
remote:            281 |   });
remote:        Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--5-1!node_modules/postcss-loader/src/index.js??ref--5-2!node_modules/@reach/combobox/styles.css:
remote:            Entrypoint mini-css-extract-plugin = *
remote:            [0] ./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.27 KiB {0} [built]
remote:            [1] ./node_modules/css-loader/dist/runtime/api.js 1.57 KiB {0} [built]
remote:            [2] ./node_modules/css-loader/dist/cjs.js??ref--5-1!./node_modules/postcss-loader/src??ref--5-2!./node_modules/@reach/combobox/styles.css 2.33 KiB {0} [built]
remote:        Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--5-1!node_modules/postcss-loader/src/index.js??ref--5-2!node_modules/@sayrhino/rhino-shared-js/build/datepicker.css:
remote:            Entrypoint mini-css-extract-plugin = *
remote:            [0] ./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.27 KiB {0} [built]
remote:            [1] ./node_modules/css-loader/dist/runtime/api.js 1.57 KiB {0} [built]
remote:            [2] ./node_modules/css-loader/dist/cjs.js??ref--5-1!./node_modules/postcss-loader/src??ref--5-2!./node_modules/@sayrhino/rhino-shared-js/build/datepicker.css 53.1 KiB {0} [built]
remote:        Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/components/common/forms/RadioLabel.scss:
remote:            Entrypoint mini-css-extract-plugin = *
remote:            [0] ./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.27 KiB {0} [built]
remote:            [1] ./node_modules/css-loader/dist/runtime/api.js 1.57 KiB {0} [built]
remote:            [2] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/components/common/forms/RadioLabel.scss 765 bytes {0} [built]
remote:        Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/components/common/functions.scss:
remote:            Entrypoint mini-css-extract-plugin = *
remote:            [0] ./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.27 KiB {0} [built]
remote:            [1] ./node_modules/css-loader/dist/runtime/api.js 1.57 KiB {0} [built]
remote:            [2] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/components/common/functions.scss 516 bytes {0} [built]
remote:        
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
mame commented

Sorry for the inconvenience. I have just released typeprof-0.21.3 that excludes vscode/ directory. Please upgrade the typeprof gem to 0.21.3, and then the issue should disappear.

Alternatively, if you cannot upgrade typeprof, you may want to exclude vendor/ directory from the check of tsc by modifying your tsconfig.json as follows:

{
    ...,
    "exclude": [
        "vendor"
    ]
}