Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ignore ts warning #9015

Merged
merged 1 commit into from Jul 11, 2022
Merged

chore: ignore ts warning #9015

merged 1 commit into from Jul 11, 2022

Conversation

caoxiemeihao
Copy link
Contributor

@caoxiemeihao caoxiemeihao commented Jul 10, 2022

Description

Actually the error is already handled here.

this.error(
`Failed to resolve import "${url}" from "${path.relative(
process.cwd(),
importerFile
)}". Does the file exist?`,
pos
)

So, we can ignore TS warnings.
image

Additional context

Version: 1.68.1 (Universal)
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-14T12:52:13.188Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin x64 19.6.0

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@netlify
Copy link

netlify bot commented Jul 10, 2022

Deploy Preview for vite-docs-main canceled.

Name Link
🔨 Latest commit 36ee8fa
🔍 Latest deploy log https://app.netlify.com/sites/vite-docs-main/deploys/62cab18eadd699000a2b3e9b

@bluwy
Copy link
Member

bluwy commented Jul 10, 2022

I'm not getting the error like in the screenshot, by I remember it happening if using VS Code's typescript version. Perhaps this is the case too? Anyways I think it's good to anticipate this once we upgrade TypeScript, and maybe the simpler fix is to use a return after this.error instead so we don't need to use !.

We should also do this for importAnalysisBuild:

this.error(
`Failed to resolve import "${url}" from "${path.relative(
process.cwd(),
importerFile
)}". Does the file exist?`,
pos
)

@sapphi-red
Copy link
Member

I'm not getting the error too. (TypeScript 4.6.4 (workspace), TypeScript 4.7.3 (vscode))

this.error has never as a return type, so I don't think the explicit return is needed?
https://github.com/rollup/rollup/blob/0ab16cc04b7d6dfe5bd14340ba7448085a379e25/src/rollup/types.d.ts#L193

@caoxiemeihao
Copy link
Contributor Author

caoxiemeihao commented Jul 10, 2022

There is a notable!

This problem occurs when /packages/vite opened as VSCode path, but / does not.


image

image

@bluwy
Copy link
Member

bluwy commented Jul 11, 2022

For me, even if there's no errors, when I hover resolved it still gives ResolvedId | null even when this.error should have removed the null possibility. Also after changing TS to vscode version, I had to reload the window to see the errors, maybe this happens for you too @sapphi-red. Anyways I think it's fine to add this workaround for now to appease TS.

@patak-dev patak-dev merged commit e2a6bf4 into vitejs:main Jul 11, 2022
@caoxiemeihao caoxiemeihao deleted the fix/ts-warn branch July 18, 2022 04:39
@bluwy bluwy mentioned this pull request Aug 7, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants