1. Vue module augmentation (src/shims-vue.d.ts) *Added ComponentCustomProperties so this.$store is typed as Store<RootState> in components. *Extended Window for $ and jQuery so the jQuery global assignment type-checks. 2. Convert main.js to main.ts *Renamed main.js to main.ts. *Removed the vue.config.js entry override so the Vue CLI TypeScript plugin uses main.ts. *Updated jest.config.js to exclude main.ts from coverage. *Adjusted the error handler to use unknown for err and vm to match Vue’s types. *Added as unknown to the jQuery require for type safety.
21 lines
447 B
TypeScript
21 lines
447 B
TypeScript
/**
|
|
* Vue module augmentation for typed $store in components.
|
|
* Enables this.$store to be typed with RootState in Vue components.
|
|
*/
|
|
import type { Store } from "vuex";
|
|
import type { RootState } from "@/store/types";
|
|
|
|
declare module "@vue/runtime-core" {
|
|
interface ComponentCustomProperties {
|
|
$store: Store<RootState>;
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
$: unknown;
|
|
jQuery: unknown;
|
|
}
|
|
}
|
|
|
|
export {};
|