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

View File

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

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

View File

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