diff --git a/babel.config.js b/babel.config.js index 35e03527d..fbc7468ef 100644 --- a/babel.config.js +++ b/babel.config.js @@ -5,6 +5,9 @@ function isBabelLoader(caller) { module.exports = function (api) { if (api.env("test") && !api.caller(isBabelLoader)) { return { + plugins: [ + "@babel/plugin-proposal-class-properties" + ], presets: [ [ "@babel/preset-env", diff --git a/components/app/Section.vue b/components/app/Section.vue index b16560b38..c9a822171 100644 --- a/components/app/Section.vue +++ b/components/app/Section.vue @@ -34,14 +34,15 @@ fieldset { } - diff --git a/components/collections/Add.vue b/components/collections/Add.vue index e8e98a183..545d103ee 100644 --- a/components/collections/Add.vue +++ b/components/collections/Add.vue @@ -38,6 +38,7 @@ diff --git a/plugins/vue-rx.js b/plugins/vue-rx.js new file mode 100644 index 000000000..23156b5bc --- /dev/null +++ b/plugins/vue-rx.js @@ -0,0 +1,4 @@ +import Vue from "vue" +import VueRx from "vue-rx" + +Vue.use(VueRx) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..495c19930 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "ESNext", + "moduleResolution": "Node", + "lib": ["ESNext", "ESNext.AsyncIterable", "DOM"], + "esModuleInterop": true, + "allowJs": true, + "sourceMap": true, + "strict": true, + "noEmit": true, + "baseUrl": ".", + "paths": { + "~/*": ["./*"], + "@/*": ["./*"] + }, + "types": ["@types/node", "@nuxt/types", "nuxt-i18n", "@nuxtjs/toast", "vue-rx"] + }, + "exclude": ["node_modules"] +} diff --git a/types/pw-ext-hook.d.ts b/types/pw-ext-hook.d.ts new file mode 100644 index 000000000..17183a56a --- /dev/null +++ b/types/pw-ext-hook.d.ts @@ -0,0 +1,21 @@ +interface PWExtensionRequestInfo { + method: string + url: string + data: any & { wantsBinary: boolean } +} + +interface PWExtensionResponse { + data: any + config?: { + timeData?: { + startTime: number + endTime: number + } + } +} + +interface PWExtensionHook { + getVersion: () => { major: number, minor: number } + sendRequest: (req: PWExtensionRequestInfo) => Promise + cancelRunningRequest: () => void +} diff --git a/types/ts-utils.d.ts b/types/ts-utils.d.ts new file mode 100644 index 000000000..704badee9 --- /dev/null +++ b/types/ts-utils.d.ts @@ -0,0 +1 @@ +export type KeysMatching = {[K in keyof T]-?: T[K] extends V ? K : never}[keyof T]; diff --git a/types/window.d.ts b/types/window.d.ts new file mode 100644 index 000000000..424c7bf33 --- /dev/null +++ b/types/window.d.ts @@ -0,0 +1,7 @@ +export {} + +declare global { + interface Window { + __POSTWOMAN_EXTENSION_HOOK__: PWExtensionHook + } +} diff --git a/vue-shim.d.ts b/vue-shim.d.ts new file mode 100644 index 000000000..eb40980e5 --- /dev/null +++ b/vue-shim.d.ts @@ -0,0 +1,4 @@ +declare module "*.vue" { + import Vue from 'vue' + export default Vue +}