Install vue-tsc to check types in <script setup> components

https://github.com/vuejs/core/issues/4887
This commit is contained in:
silverpill 2022-05-28 23:39:05 +00:00
parent 7751992618
commit 821e290b45
9 changed files with 345 additions and 17 deletions

325
package-lock.json generated
View file

@ -47,7 +47,8 @@
"sinon-chai": "^3.7.0",
"stylelint": "^13.13.1",
"stylelint-config-sass-guidelines": "^8.0.0",
"typescript": "~4.5.5"
"typescript": "~4.5.5",
"vue-tsc": "^0.35.0"
}
},
"node_modules/@achrinza/node-ipc": {
@ -1991,6 +1992,153 @@
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
"dev": true
},
"node_modules/@volar/code-gen": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/code-gen/-/code-gen-0.35.0.tgz",
"integrity": "sha512-MUKPjE6VL97R2Dg3MwUexjKsdHRhX2cEQUWDtl7Zgn7fe60mULQOHcZZ+IU49eTgyOjAj0Z2hm7hub/nBxduxw==",
"dev": true,
"dependencies": {
"@volar/source-map": "0.35.0"
}
},
"node_modules/@volar/source-map": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-0.35.0.tgz",
"integrity": "sha512-VvVyCW8SEQ297zoeZNi4HOSLU8H7/xbGg4WpcpVOy080y/MXTxjIZshSlMHx45EB91U2vk0gbgd2R/d9uyY+3A==",
"dev": true
},
"node_modules/@volar/vue-code-gen": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/vue-code-gen/-/vue-code-gen-0.35.0.tgz",
"integrity": "sha512-IqIkzs3eRlJjABVXXBf5ik4/a8lQ3wqKemWMR33+KzOmj5xtXS+lgMMLNXJpj0Mw2nOLVl0I2KuIaTHFy485DQ==",
"dev": true,
"dependencies": {
"@volar/code-gen": "0.35.0",
"@volar/source-map": "0.35.0",
"@vue/compiler-core": "^3.2.36",
"@vue/compiler-dom": "^3.2.36",
"@vue/shared": "^3.2.36"
}
},
"node_modules/@volar/vue-code-gen/node_modules/@vue/compiler-core": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.36.tgz",
"integrity": "sha512-bbyZM5hvBicv0PW3KUfVi+x3ylHnfKG7DOn5wM+f2OztTzTjLEyBb/5yrarIYpmnGitVGbjZqDbODyW4iK8hqw==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"node_modules/@volar/vue-code-gen/node_modules/@vue/compiler-dom": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.36.tgz",
"integrity": "sha512-tcOTAOiW4s24QLnq+ON6J+GRONXJ+A/mqKCORi0LSlIh8XQlNnlm24y8xIL8la+ZDgkdbjarQ9ZqYSvEja6gVA==",
"dev": true,
"dependencies": {
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36"
}
},
"node_modules/@volar/vue-code-gen/node_modules/@vue/shared": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.36.tgz",
"integrity": "sha512-JtB41wXl7Au3+Nl3gD16Cfpj7k/6aCroZ6BbOiCMFCMvrOpkg/qQUXTso2XowaNqBbnkuGHurLAqkLBxNGc1hQ==",
"dev": true
},
"node_modules/@volar/vue-typescript": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-0.35.0.tgz",
"integrity": "sha512-Ojn98P888wWbk1qeR5f6spgtJZMwUos+OkJfZpzyafN5S21LxF58o7DhhNG8rMm1zMNUQHb+evlp5AXI5zHOmA==",
"dev": true,
"dependencies": {
"@volar/code-gen": "0.35.0",
"@volar/source-map": "0.35.0",
"@volar/vue-code-gen": "0.35.0",
"@vue/compiler-sfc": "^3.2.36",
"@vue/reactivity": "^3.2.36"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/compiler-core": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.36.tgz",
"integrity": "sha512-bbyZM5hvBicv0PW3KUfVi+x3ylHnfKG7DOn5wM+f2OztTzTjLEyBb/5yrarIYpmnGitVGbjZqDbODyW4iK8hqw==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/compiler-dom": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.36.tgz",
"integrity": "sha512-tcOTAOiW4s24QLnq+ON6J+GRONXJ+A/mqKCORi0LSlIh8XQlNnlm24y8xIL8la+ZDgkdbjarQ9ZqYSvEja6gVA==",
"dev": true,
"dependencies": {
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/compiler-sfc": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.36.tgz",
"integrity": "sha512-AvGb4bTj4W8uQ4BqaSxo7UwTEqX5utdRSMyHy58OragWlt8nEACQ9mIeQh3K4di4/SX+41+pJrLIY01lHAOFOA==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.36",
"@vue/compiler-dom": "3.2.36",
"@vue/compiler-ssr": "3.2.36",
"@vue/reactivity-transform": "3.2.36",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7",
"postcss": "^8.1.10",
"source-map": "^0.6.1"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/compiler-ssr": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.36.tgz",
"integrity": "sha512-+KugInUFRvOxEdLkZwE+W43BqHyhBh0jpYXhmqw1xGq2dmE6J9eZ8UUSOKNhdHtQ/iNLWWeK/wPZkVLUf3YGaw==",
"dev": true,
"dependencies": {
"@vue/compiler-dom": "3.2.36",
"@vue/shared": "3.2.36"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/reactivity": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.36.tgz",
"integrity": "sha512-c2qvopo0crh9A4GXi2/2kfGYMxsJW4tVILrqRPydVGZHhq0fnzy6qmclWOhBFckEhmyxmpHpdJtIRYGeKcuhnA==",
"dev": true,
"dependencies": {
"@vue/shared": "3.2.36"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/reactivity-transform": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.36.tgz",
"integrity": "sha512-Jk5o2BhpODC9XTA7o4EL8hSJ4JyrFWErLtClG3NH8wDS7ri9jBDWxI7/549T7JY9uilKsaNM+4pJASLj5dtRwA==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7"
}
},
"node_modules/@volar/vue-typescript/node_modules/@vue/shared": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.36.tgz",
"integrity": "sha512-JtB41wXl7Au3+Nl3gD16Cfpj7k/6aCroZ6BbOiCMFCMvrOpkg/qQUXTso2XowaNqBbnkuGHurLAqkLBxNGc1hQ==",
"dev": true
},
"node_modules/@vue/cli-overlay": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@vue/cli-overlay/-/cli-overlay-5.0.4.tgz",
@ -14710,6 +14858,21 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"node_modules/vue-tsc": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-0.35.0.tgz",
"integrity": "sha512-RcL7PM3M1nSaVQU84mRPOXk1t/mAZ25QCx4L0rNQzozJYhz1wSVQWYqq9UfhE2lW8nMAQzQtLZgvjaPR4Q29ZA==",
"dev": true,
"dependencies": {
"@volar/vue-typescript": "0.35.0"
},
"bin": {
"vue-tsc": "bin/vue-tsc.js"
},
"peerDependencies": {
"typescript": "*"
}
},
"node_modules/vue3-click-away": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/vue3-click-away/-/vue3-click-away-1.2.4.tgz",
@ -17134,6 +17297,157 @@
"integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==",
"dev": true
},
"@volar/code-gen": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/code-gen/-/code-gen-0.35.0.tgz",
"integrity": "sha512-MUKPjE6VL97R2Dg3MwUexjKsdHRhX2cEQUWDtl7Zgn7fe60mULQOHcZZ+IU49eTgyOjAj0Z2hm7hub/nBxduxw==",
"dev": true,
"requires": {
"@volar/source-map": "0.35.0"
}
},
"@volar/source-map": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-0.35.0.tgz",
"integrity": "sha512-VvVyCW8SEQ297zoeZNi4HOSLU8H7/xbGg4WpcpVOy080y/MXTxjIZshSlMHx45EB91U2vk0gbgd2R/d9uyY+3A==",
"dev": true
},
"@volar/vue-code-gen": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/vue-code-gen/-/vue-code-gen-0.35.0.tgz",
"integrity": "sha512-IqIkzs3eRlJjABVXXBf5ik4/a8lQ3wqKemWMR33+KzOmj5xtXS+lgMMLNXJpj0Mw2nOLVl0I2KuIaTHFy485DQ==",
"dev": true,
"requires": {
"@volar/code-gen": "0.35.0",
"@volar/source-map": "0.35.0",
"@vue/compiler-core": "^3.2.36",
"@vue/compiler-dom": "^3.2.36",
"@vue/shared": "^3.2.36"
},
"dependencies": {
"@vue/compiler-core": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.36.tgz",
"integrity": "sha512-bbyZM5hvBicv0PW3KUfVi+x3ylHnfKG7DOn5wM+f2OztTzTjLEyBb/5yrarIYpmnGitVGbjZqDbODyW4iK8hqw==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"@vue/compiler-dom": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.36.tgz",
"integrity": "sha512-tcOTAOiW4s24QLnq+ON6J+GRONXJ+A/mqKCORi0LSlIh8XQlNnlm24y8xIL8la+ZDgkdbjarQ9ZqYSvEja6gVA==",
"dev": true,
"requires": {
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36"
}
},
"@vue/shared": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.36.tgz",
"integrity": "sha512-JtB41wXl7Au3+Nl3gD16Cfpj7k/6aCroZ6BbOiCMFCMvrOpkg/qQUXTso2XowaNqBbnkuGHurLAqkLBxNGc1hQ==",
"dev": true
}
}
},
"@volar/vue-typescript": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/@volar/vue-typescript/-/vue-typescript-0.35.0.tgz",
"integrity": "sha512-Ojn98P888wWbk1qeR5f6spgtJZMwUos+OkJfZpzyafN5S21LxF58o7DhhNG8rMm1zMNUQHb+evlp5AXI5zHOmA==",
"dev": true,
"requires": {
"@volar/code-gen": "0.35.0",
"@volar/source-map": "0.35.0",
"@volar/vue-code-gen": "0.35.0",
"@vue/compiler-sfc": "^3.2.36",
"@vue/reactivity": "^3.2.36"
},
"dependencies": {
"@vue/compiler-core": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.2.36.tgz",
"integrity": "sha512-bbyZM5hvBicv0PW3KUfVi+x3ylHnfKG7DOn5wM+f2OztTzTjLEyBb/5yrarIYpmnGitVGbjZqDbODyW4iK8hqw==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"@vue/compiler-dom": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.2.36.tgz",
"integrity": "sha512-tcOTAOiW4s24QLnq+ON6J+GRONXJ+A/mqKCORi0LSlIh8XQlNnlm24y8xIL8la+ZDgkdbjarQ9ZqYSvEja6gVA==",
"dev": true,
"requires": {
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36"
}
},
"@vue/compiler-sfc": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.2.36.tgz",
"integrity": "sha512-AvGb4bTj4W8uQ4BqaSxo7UwTEqX5utdRSMyHy58OragWlt8nEACQ9mIeQh3K4di4/SX+41+pJrLIY01lHAOFOA==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.36",
"@vue/compiler-dom": "3.2.36",
"@vue/compiler-ssr": "3.2.36",
"@vue/reactivity-transform": "3.2.36",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7",
"postcss": "^8.1.10",
"source-map": "^0.6.1"
}
},
"@vue/compiler-ssr": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.2.36.tgz",
"integrity": "sha512-+KugInUFRvOxEdLkZwE+W43BqHyhBh0jpYXhmqw1xGq2dmE6J9eZ8UUSOKNhdHtQ/iNLWWeK/wPZkVLUf3YGaw==",
"dev": true,
"requires": {
"@vue/compiler-dom": "3.2.36",
"@vue/shared": "3.2.36"
}
},
"@vue/reactivity": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.2.36.tgz",
"integrity": "sha512-c2qvopo0crh9A4GXi2/2kfGYMxsJW4tVILrqRPydVGZHhq0fnzy6qmclWOhBFckEhmyxmpHpdJtIRYGeKcuhnA==",
"dev": true,
"requires": {
"@vue/shared": "3.2.36"
}
},
"@vue/reactivity-transform": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/reactivity-transform/-/reactivity-transform-3.2.36.tgz",
"integrity": "sha512-Jk5o2BhpODC9XTA7o4EL8hSJ4JyrFWErLtClG3NH8wDS7ri9jBDWxI7/549T7JY9uilKsaNM+4pJASLj5dtRwA==",
"dev": true,
"requires": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.36",
"@vue/shared": "3.2.36",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7"
}
},
"@vue/shared": {
"version": "3.2.36",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.2.36.tgz",
"integrity": "sha512-JtB41wXl7Au3+Nl3gD16Cfpj7k/6aCroZ6BbOiCMFCMvrOpkg/qQUXTso2XowaNqBbnkuGHurLAqkLBxNGc1hQ==",
"dev": true
}
}
},
"@vue/cli-overlay": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@vue/cli-overlay/-/cli-overlay-5.0.4.tgz",
@ -26711,6 +27025,15 @@
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
"dev": true
},
"vue-tsc": {
"version": "0.35.0",
"resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-0.35.0.tgz",
"integrity": "sha512-RcL7PM3M1nSaVQU84mRPOXk1t/mAZ25QCx4L0rNQzozJYhz1wSVQWYqq9UfhE2lW8nMAQzQtLZgvjaPR4Q29ZA==",
"dev": true,
"requires": {
"@volar/vue-typescript": "0.35.0"
}
},
"vue3-click-away": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/vue3-click-away/-/vue3-click-away-1.2.4.tgz",

View file

@ -12,7 +12,8 @@
"lint:js": "vue-cli-service lint --no-fix",
"lint:css": "stylelint 'src/**/*.{vue,scss}'",
"lint": "npm run lint:js && npm run lint:css",
"start": "npm run serve"
"start": "npm run serve",
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"ethereum-blockies-base64": "^1.0.2",
@ -53,7 +54,8 @@
"sinon-chai": "^3.7.0",
"stylelint": "^13.13.1",
"stylelint-config-sass-guidelines": "^8.0.0",
"typescript": "~4.5.5"
"typescript": "~4.5.5",
"vue-tsc": "^0.35.0"
},
"lavamoat": {
"allowScripts": {

View file

@ -67,7 +67,7 @@
type="submit"
v-if="inReplyTo"
class="submit-btn-small"
@click.prevent="publish($event)"
@click.prevent="publish()"
>
Publish
</button>

View file

@ -46,10 +46,9 @@ function isPageFull(): boolean {
}
function loadNextPage() {
let maxId
if (props.posts.length > 0) {
maxId = props.posts[props.posts.length - 1].id
const maxId = props.posts[props.posts.length - 1].id
emit("load-next-page", maxId)
}
emit("load-next-page", maxId)
}
</script>

View file

@ -25,7 +25,7 @@ const props = defineProps<{
post: PostObject,
}>()
const emit = defineEmits<{(event: "post-deleted"): void}>()
const emit = defineEmits<{(event: "post-deleted", postId: string): void}>()
function onPostDeleted(postId: string) {
emit("post-deleted", postId)

View file

@ -1,5 +1,5 @@
<template>
<form class="search" @submit.prevent="search($event)">
<form class="search" @submit.prevent="search()">
<input type="text" placeholder="Search..." v-model="q">
<button v-if="q" type="button" @click="clear()">
<img :src="require('@/assets/feather/delete.svg')">

View file

@ -8,7 +8,7 @@
<div class="token">
<div class="token-content">
<div class="token-description" v-html="token.description"></div>
<div class="token-image">
<div class="token-image" v-if="imageUrl">
<img :src="imageUrl">
</div>
</div>

View file

@ -56,6 +56,7 @@
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
import { ref, onMounted } from "vue"
import { $, $ref } from "vue/macros"
import { useRoute } from "vue-router"
import {
@ -91,10 +92,10 @@ let subscriptionState = $ref<SubscriptionState | null>(null)
let subscriberAddress = $ref<string | null>(null)
onMounted(async () => {
const { authToken } = useCurrentUser()
const { authToken } = $(useCurrentUser())
profile = await getProfile(
authToken,
route.params.profileId,
route.params.profileId as string,
)
profileEthereumAddress = getVerifiedEthereumAddress(profile)
})
@ -125,6 +126,9 @@ function disconnectWallet() {
}
async function connectWallet() {
if (!profileEthereumAddress) {
return
}
const web3Provider = getWeb3Provider()
const signer = await getWallet(web3Provider)
if (!signer) {
@ -186,7 +190,7 @@ async function checkSubscription() {
function canConfigureSubscription(): boolean {
return (
isCurrentUser() &&
currentUser.wallet_address &&
Boolean(currentUser?.wallet_address) &&
subscriptionConfigured === false
)
}
@ -251,7 +255,7 @@ async function onMakeSubscriptionPayment() {
function canCancel(): boolean {
return (
!isCurrentUser() &&
subscriptionState?.senderBalance &&
subscriptionState !== null &&
!subscriptionState.senderBalance.isZero()
)
}
@ -280,7 +284,7 @@ async function onCancelSubscription() {
}
function isRecipient(): boolean {
return isCurrentUser() && subscription
return isCurrentUser() && subscription !== null
}
async function onCheckSubsciptionState() {

View file

@ -27,7 +27,7 @@ onMounted(async () => {
const { authToken } = useCurrentUser()
posts.value = await getTagTimeline(
authToken.value,
route.params.tagName,
route.params.tagName as string,
)
})
@ -35,7 +35,7 @@ async function loadNextPage(maxId: string) {
const { authToken } = useCurrentUser()
const newPosts = await getTagTimeline(
authToken.value,
route.params.tagName,
route.params.tagName as string,
maxId,
)
posts.value.push(...newPosts)