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

not unwrapping DistributeRef<> for destructed props #4820

Closed
n0099 opened this issue Sep 6, 2024 · 4 comments · Fixed by #4821
Closed

not unwrapping DistributeRef<> for destructed props #4820

n0099 opened this issue Sep 6, 2024 · 4 comments · Fixed by #4821
Labels
bug Something isn't working

Comments

@n0099
Copy link

n0099 commented Sep 6, 2024

Vue - Official extension or vue-tsc version

both 2.1.6

VSCode version

1.93.0

Vue version

3.5.1

TypeScript version

5.5.4

System Info

System:
  OS: Windows 11 10.0.22631
  CPU: (4) x64 Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz
  Memory: 7.49 GB / 15.91 GB
Binaries:
  Node: 22.8.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 4.4.1 - C:\Program Files\nodejs\yarn.CMD
  npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Chromium (127.0.2651.74)
  Internet Explorer: 11.0.22621.3527

package.json dependencies

https://github.com/n0099/open-tbm/blob/2567a865f055a64629633a812ecd59197411bbca/fe/package.json

Steps to reproduce

git clone https://github.com/n0099/open-tbm && cd open-tbm
git checkout 2567a865f055a64629633a812ecd59197411bbca
cd fe
yarn
code -g src/components/post/badge/Time.vue:6

https://github.com/n0099/open-tbm/blob/2567a865f055a64629633a812ecd59197411bbca/fe/src/components/post/badge/Time.vue#L6

What is expected?

Not reporting.

What is actually happening?

Argument of type 'TPostIDKey' is not assignable to parameter of type 'keyof DistributeRef<TPost> & PostIDOf<DistributeRef<TPost>>'.
  Type 'keyof TPost & PostIDOf<TPost>' is not assignable to type 'keyof DistributeRef<TPost> & PostIDOf<DistributeRef<TPost>>'.
    Type 'keyof TPost & PostIDOf<TPost>' is not assignable to type 'keyof DistributeRef<TPost>'.
      Type 'TPostIDKey' is not assignable to type 'keyof DistributeRef<TPost>'.
        Type 'keyof TPost & PostIDOf<TPost>' is not assignable to type 'keyof DistributeRef<TPost>'.
          Type 'keyof TPost & PostIDOf<TPost>' is not assignable to type '"tid" | "createdAt" | "updatedAt" | "authorUid" | "postedAt" | "lastSeenAt" | "agreeCount" | "disagreeCount"'.
            Type 'TPostIDKey' is not assignable to type '"tid" | "createdAt" | "updatedAt" | "authorUid" | "postedAt" | "lastSeenAt" | "agreeCount" | "disagreeCount"'.
              Type 'keyof TPost & PostIDOf<TPost>' is not assignable to type '"tid" | "createdAt" | "updatedAt" | "authorUid" | "postedAt" | "lastSeenAt" | "agreeCount" | "disagreeCount"'.
ts-plugin(2345)

Link to minimal reproduction

https://github.com/n0099/open-tbm/blob/2567a865f055a64629633a812ecd59197411bbca/fe

Any additional comments?

Not destructing props will fix this:

-const { previousPost, nextPost, currentPost, parentPost, postTimeKey } = defineProps<{
+const props = defineProps<{

Another example can be found at https://github.com/n0099/open-tbm/blob/2567a865f055a64629633a812ecd59197411bbca/fe/src/components/post/badge/Common.vue#L3

Type 'TPostIDKey' cannot be used to index type 'DistributeRef<TPost>'.
ts-plugin(2536)

Another typing error for prop timestampType is already reported as #4798

n0099 added a commit to n0099/open-tbm that referenced this issue Sep 6, 2024
… @ `<PostBadgeCommon>`

$ git checkout 2567a86^1 src/components/post/badge/{Common,Time}.vue # to fix vuejs/language-tools#4820

+ type `PostID` to reuse union `Tid | Pid | Spid`
* rename the original type `PostID` to `PostIDStr`
@ index.ts

* rename prop `selector` to `el` in the returned value of `postListItemScrollPosition()` for matching with type `RouterScrollBehavior`, partial revert fec399a @ post/renderer/list/scroll.ts
@ utils
@ fe
@KazariEX
Copy link
Collaborator

KazariEX commented Sep 6, 2024

Unfortunately, it works well on my machine without any errors.

@n0099
Copy link
Author

n0099 commented Sep 6, 2024

Did you ran git checkout 2567a865f055a64629633a812ecd59197411bbca? It's reproductible in CI: https://github.com/n0099/open-tbm/actions/runs/10736670983/job/29776575723

@KazariEX KazariEX added bug Something isn't working and removed need info labels Sep 6, 2024
n0099 added a commit to n0099/open-tbm that referenced this issue Sep 19, 2024
* fix vueuse/vueuse#4216 @ utils/echarts.ts
* fix typescript-eslint/typescript-eslint#9706 @ api/index.ts
* fix violation of eslitn rule `@stylistic/indent` @ pages/posts.vue
$ git checkout 982e84b^1 src/components/post/badge/{Common,Time}.vue # to fix vuejs/language-tools#4820
@ fe
n0099 added a commit to n0099/open-tbm that referenced this issue Sep 19, 2024
* fix vueuse/vueuse#4216 @ utils/echarts.ts
* fix typescript-eslint/typescript-eslint#9706 @ api/index.ts
* fix violation of eslitn rule `@stylistic/indent` @ pages/posts.vue
$ git checkout 982e84b^1 src/components/post/badge/{Common,Time}.vue # to fix vuejs/language-tools#4820
@ fe

$ git ls-files -z | xargs -0 sed -i 's/\t/    /g'
@n0099
Copy link
Author

n0099 commented Sep 19, 2024

@KazariEX
Copy link
Collaborator

This pr has not been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants