Fix type declarations
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2021-07-19 18:33:09 +02:00
parent 52824a96f3
commit 9f102576a6
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
6 changed files with 29 additions and 7 deletions

View File

@ -119,11 +119,17 @@
],
"testEnvironment": "jsdom",
"preset": "ts-jest",
"roots": ["<rootDir>/src"],
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.(js|tsx?)$": "ts-jest"
},
"moduleFileExtensions": ["ts", "js", "json"]
"moduleFileExtensions": [
"ts",
"js",
"json"
]
},
"license": "AGPL-3.0-or-later"
}

View File

@ -2,10 +2,18 @@ import Vue from 'vue'
import App from './App.vue'
import router from './router'
declare global {
interface Window {
API_URL: string;
}
}
import {formatDate, formatDateSince} from '@/helpers/time/formatDate'
// @ts-ignore
import {VERSION} from './version.json'
// Register the modal
// @ts-ignore
import Modal from './components/modal/modal'
// Add CSS
import './styles/vikunja.scss'
@ -80,6 +88,7 @@ import {FontAwesomeIcon} from '@fortawesome/vue-fontawesome'
import './registerServiceWorker'
// Shortcuts
// @ts-ignore - no types available
import vueShortkey from 'vue-shortkey'
// Mixins
import message from './message'
@ -90,6 +99,7 @@ import {getListTitle} from './helpers/getListTitle'
// Vuex
import {store} from './store'
// i18n
import VueI18n from 'vue-i18n' // types
import {i18n} from './i18n/setup'
console.info(`Vikunja frontend version ${VERSION}`)
@ -180,12 +190,15 @@ Vue.directive('focus', focus)
import tooltip from '@/directives/tooltip'
// @ts-ignore
Vue.directive('tooltip', tooltip)
// @ts-ignore
import Button from '@/components/input/button'
Vue.component('x-button', Button)
// @ts-ignore
import Card from '@/components/misc/card'
Vue.component('card', Card)
@ -193,7 +206,7 @@ Vue.component('card', Card)
Vue.mixin({
methods: {
formatDateSince(date) {
return formatDateSince(date, (p, params) => this.$t(p, params))
return formatDateSince(date, (p: VueI18n.Path, params?: VueI18n.Values) => this.$t(p, params))
},
formatDate(date) {
return formatDate(date, 'PPPPpppp', this.$t('date.locale'))
@ -202,16 +215,16 @@ Vue.mixin({
return formatDate(date, 'PPpp', this.$t('date.locale'))
},
getNamespaceTitle(n) {
return getNamespaceTitle(n, p => this.$t(p))
return getNamespaceTitle(n, (p: VueI18n.Path) => this.$t(p))
},
getListTitle(l) {
return getListTitle(l, p => this.$t(p))
return getListTitle(l, (p: VueI18n.Path) => this.$t(p))
},
error(e, actions = []) {
return message.error(e, this, p => this.$t(p), actions)
return message.error(e, this, (p: VueI18n.Path) => this.$t(p), actions)
},
success(s, actions = []) {
return message.success(s, this, p => this.$t(p), actions)
return message.success(s, this, (p: VueI18n.Path) => this.$t(p), actions)
},
colorIsDark: colorIsDark,
setTitle: setTitle,

0
src/types/window.d.ts vendored Normal file
View File

View File

@ -19,6 +19,9 @@
"paths": {
"@/*": [
"src/*"
],
"*": [
"types/*.d.ts"
]
},
"lib": [