-
Notifications
You must be signed in to change notification settings - Fork 70
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
semantic error TS2339: Property 'name' does not exist on type 'User'
with rpt2 but not tsc
when using Vite -- can't repro
#297
Comments
It seems like I am gonna have to set the I think it's a major feature since failing the build if the type checking failed is a core feature of TS. |
That supposed to work I think -- rpt2 uses this syntax itself in host.ts for example, and it builds itself with an older version of itself... |
Just an update in case someone runs into this issue. noEmitHelpers: false,
importHelpers: true,
noResolve: false,
inlineSourceMap: false,
allowNonTsExtensions: true,
module: 5, I am not sure if this is the problem , but It might save some debugging for someone. |
It is explicitly mentioned in the docs that some options are forced as they're required for rpt2 / Rollup compat
Probably not, but there's some head-scratching issues where the output is not equivalent to |
semantic error TS2339: Property 'name' does not exist on type 'User'
with rpt2 but not tsc when using Vite
Ok, so I looked into this and created a minimal repro here and was unable to reproduce this. It took me a bit to even create the reproduction as OP's first edit broke all the code examples, causing errors in both In any case, the minimal environment linked above has all 3 examples and rpt2 passes on all 3 of them. So the issue you're having is not due to rpt2, but your configuration. Specifically, you wrote:
But left out a very important detail, that you're using Vite to build instead of Rollup. And then you did not provide your I had to interpret your logs and your previous comment to figure out that you were using Vite:
Vite already supports TypeScript out-of-the-box with The error you're getting is also similar to #235, which is due to a bug within So this either a bug in Vite itself or a misconfiguration. But as it's not reproducible with just rpt2 and Rollup, it's not a bug in this library. |
semantic error TS2339: Property 'name' does not exist on type 'User'
with rpt2 but not tsc when using Vitesemantic error TS2339: Property 'name' does not exist on type 'User'
with rpt2 but not tsc
when using Vite
semantic error TS2339: Property 'name' does not exist on type 'User'
with rpt2 but not tsc
when using Vitesemantic error TS2339: Property 'name' does not exist on type 'User'
with rpt2 but not tsc
when using Vite -- can't repro
What happens and why it is wrong
When defining class property in the constructor for example:
Result => build fails with following error:
semantic error TS2339: Property 'name' does not exist on type 'User'.
When doing the same thing but defining the property as a class member
Result => build pass.
When defining as class property in the constructor and trying to access
Result => build fails with the same error.
For all cases, running
tsc -b
works great.I am having trouble believing it never happened to anyone as this package is popular. Couldn't find any open issue about this. The parsed ts-config seems fine in the logs.
Environment
MacOS Monterey
VS-Code
Node 17.3.1
Versions
rollup.config.js
I don't use one
tsconfig.json
`tsconfig.json`:
plugin output with verbosity 3 - failure case
plugin output with verbosity 3:
plugin output with verbosity 3 - success case
plugin output with verbosity 3:
The text was updated successfully, but these errors were encountered: