Vue · Senior · Question 53 of 75
How do you type a global property like $t added with app.config.globalProperties?
declare module 'vue' {
interface ComponentCustomProperties {
$t: (key: string) => string
}
}- ✓Correct answer: Augment
ComponentCustomPropertiesin thevuemodule - 2Add it to
defineProps - 3Global properties can't be typed
Explanation
Global properties are mainly for templates and the Options API; in <script setup> prefer provide/inject or a composable.