-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript declaration is missing #8
Comments
Would be great if the package included typescript declaration. Separate types under @types is only an option if we can't get it in the original package. Something to get started: declare module "vue-application-insights" {
import VueRouter from "vue-router";
import _Vue from "vue";
export interface VueApplicationInsights {
trackEvent(name: string, options: any): void;
}
export interface PluginOptions {
id: string;
baseName?: string;
router?: VueRouter;
}
export class VueApplicationInsightsPlugin {
static install(Vue: typeof _Vue, options: PluginOptions): void;
}
export default VueApplicationInsightsPlugin;
module "vue/types/vue" {
interface Vue {
$appInsights: VueApplicationInsights;
}
}
} |
This would be nice to have. |
@DavidDeSloovere thanks, I used this and extended it to use types form declare module "vue-application-insights" {
import { ApplicationInsights, IConfiguration } from "@microsoft/applicationinsights-web";
import { IConfig } from "@microsoft/applicationinsights-common";
import VueRouter from "vue-router";
import _Vue from "vue";
export interface VueApplicationInsightsPluginOptions {
id?: string;
appInsightsConfig?: IConfiguration & IConfig
baseName?: string;
router?: VueRouter;
}
export class VueApplicationInsightsPlugin {
static install(Vue: typeof _Vue, options: VueApplicationInsightsPluginOptions): void;
}
export default VueApplicationInsightsPlugin;
module "vue/types/vue" {
interface Vue {
$appInsights: ApplicationInsights;
}
}
} |
@StefanSchoof thanks! But how do you use SeverityLevels enum statically (after build)? |
@ux-engineer import { SeverityLevel } from "@microsoft/applicationinsights-web";
...
Vue.config.warnHandler = (msg, vm, trace) => {
vm.$appInsights.trackTrace({
message: msg,
properties: { trace },
severityLevel: SeverityLevel.Warning
});
// Same as https://github.com/vuejs/vue/blob/b51430f598b354ed60851bb62885539bd25de3d8/src/core/util/debug.js#L24
console.error(`[Vue warn]: ${msg}${trace}`);
}; |
npm install @types/vue-application-insights
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fvue-application-insights - Not found
npm ERR! 404
npm ERR! 404 '@types/vue-application-insights@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
The text was updated successfully, but these errors were encountered: