vite: type error | Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref
Describe the bug
clone repo and npm install && npm run ci
current status:
https://github.com/mhf-ir/Node.js-TypeScript-Starter/actions/runs/7658137582/job/20870418679
Error: node_modules/vite/dist/node/index.d.ts(68,15): error TS2420: Class ‘import(“/home/runner/work/Node.js-TypeScript-Starter/Node.js-TypeScript-Starter/node_modules/vite/dist/node/index”, { with: { “resolution-mode”: “import” } }).FSWatcher’ incorrectly implements interface ‘import(“fs”).FSWatcher’. Type ‘FSWatcher’ is missing the following properties from type ‘FSWatcher’: ref, unref Error: Process completed with exit code 2.
Reproduction
https://github.com/mhf-ir/Node.js-TypeScript-Starter
Steps to reproduce
npm install && npm run ci
System Info
System:
OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (4) x64 AMD EPYC 7763 64-Core Processor
Memory: 14.59 GB / 15.61 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.11.0 - /opt/hostedtoolcache/node/20.11.0/x64/bin/node
Yarn: 1.22.21 - /usr/local/bin/yarn
npm: 10.2.4 - /opt/hostedtoolcache/node/20.11.0/x64/bin/npm
pnpm: 8.14.3 - /usr/local/bin/pnpm
Managers:
Apt: 2.4.11 - /usr/bin/apt
Cargo: 1.75.0 - ~/.cargo/bin/cargo
Composer: 2.6.6 - /usr/bin/composer
Gradle: 8.5 - /usr/bin/gradle
Maven: 3.8.8 - /usr/bin/mvn
pip3: 22.0.2 - /usr/bin/pip3
RubyGems: 3.3.5 - /usr/bin/gem
Utilities:
Bazel: 7.0.1 - /usr/local/bin/bazel
CMake: 3.28.1 - /usr/local/bin/cmake
Make: 4.3 - /usr/bin/make
GCC: 11.4.0 - /usr/bin/gcc
Git: 2.43.0 - /usr/bin/git
Clang: 14.0.0 - /usr/bin/clang
Mercurial: 6.1.1 - /usr/bin/hg
Subversion: 1.14.1 - /usr/bin/svn
Curl: 7.81.0 - /usr/bin/curl
Servers:
Nginx: 1.18.0 - /usr/sbin/nginx
Virtualization:
Docker: 24.0.7 - /usr/bin/docker
SDKs:
Android SDK:
API Levels: 31, 32, 33, 33, 33, 34, 34, 34
Build Tools: 31.0.0, 32.0.0, 33.0.0, 33.0.1, 33.0.2, 34.0.0
Android NDK: 25.2.9519653
IDEs:
Nano: 6.2 - /usr/bin/nano
Vim: 8.2 - /usr/bin/vim
Languages:
Bash: 5.1.16 - /usr/bin/bash
Go: 1.20.13 - /usr/bin/go
Java: 11.0.21 - /usr/bin/javac
Perl: 5.34.0 - /usr/bin/perl
PHP: 8.1.2 - /usr/bin/php
Python: 3.10.12 - /usr/bin/python
Python3: 3.10.12 - /usr/bin/python3
R: 4.3.2 - /usr/bin/R
Ruby: 3.0.2 - /usr/bin/ruby
Rust: 1.75.0 - /home/runner/.cargo/bin/rustc
Databases:
MySQL: 0.22.04.1 - /usr/bin/mysql
SQLite: 3.37.2 - /usr/bin/sqlite3
Browsers:
Chrome: 120.0.6099.224
Chromium: 120.0.6099.0
Used Package Manager
npm
Logs
Error: node_modules/vite/dist/node/index.d.ts(68,15): error TS2420: Class ‘import(“/home/runner/work/Node.js-TypeScript-Starter/Node.js-TypeScript-Starter/node_modules/vite/dist/node/index”, { with: { “resolution-mode”: “import” } }).FSWatcher’ incorrectly implements interface ‘import(“fs”).FSWatcher’. Type ‘FSWatcher’ is missing the following properties from type ‘FSWatcher’: ref, unref Error: Process completed with exit code 2.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 5
- Comments: 15 (4 by maintainers)
Commits related to this issue
- fix: force old node type version see https://github.com/vitejs/vite/issues/15714 — committed to CodinGame/monaco-vscode-api by deleted user 5 months ago
- NPM: downgrade @types/node to version 20.11.5 to fix TypeScript errors Signed-off-by: Roman Ondráček <mail@romanondracek.cz> Upstream-Issue: https://github.com/vitejs/vite/issues/15714 — committed to iqrf/iqrf-gateway-webapp by Roman3349 5 months ago
- Added github actions to run test, lint, build on PR for main branch (#24) Added github actions to run test, lint, build on PR for main branch > NOTE: temporarily skip build step during ci - there is... — committed to jakesgordon/tic-tac-toe by jakesgordon 5 months ago
- workaround https://github.com/vitejs/vite/issues/15714 with skipLibCheck: false — committed to jakesgordon/tic-tac-toe by jakesgordon 5 months ago
- workaround https://github.com/vitejs/vite/issues/15714 with skipLibCheck: false (#25) — committed to jakesgordon/tic-tac-toe by jakesgordon 5 months ago
- fix: workaround for https://github.com/vitejs/vite/issues/15714 — committed to simsustech/quasar-components by stefanvanherwijnen 5 months ago
- chore: fix https://github.com/vitejs/vite/issues/15714 — committed to tktcorporation/vrchat-join-recorder by tktcorporation 5 months ago
- Fix vitest typing https://github.com/vitejs/vite/issues/15714 — committed to oidoid/linear-text by niedzielski 5 months ago
- workaround for https://github.com/vitejs/vite/issues/15714 — committed to hmsk/vite-plugin-markdown by hmsk 5 months ago
tsconfig.json add “skipLibCheck”: true
We’re releasing 5.1 stable today (if all goes well. worst case is next Monday). There aren’t any plans to backport the fixes to v4 yet.
This is already fixed in https://github.com/vitejs/vite/pull/15706 and released in 5.1 beta
See also:
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/68300
for @types/node@20.11.6