Skip to content
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

not usable with vue cli setup typescript project #38

Open
dennissterzenbach opened this issue Jun 23, 2020 · 8 comments
Open

not usable with vue cli setup typescript project #38

dennissterzenbach opened this issue Jun 23, 2020 · 8 comments

Comments

@dennissterzenbach
Copy link

I setup a new vue project using the cli, including TypeScript support and wanted to add vuejs-logger.
I'm already using the latest version, which includes the type def (.d.ts) file. That file is recognised by VSCode, too.

However I can't get the project to compile.

this is the main.ts:

import Vue from 'vue';
import VueLogger from 'vuejs-logger';
import App from './App.vue';
import router from './router';
import store from './store';

Vue.config.productionTip = false;

const isProduction = process.env.NODE_ENV === 'production';

const options = {
    isEnabled: true,
    logLevel : isProduction ? 'error' : 'debug',
    stringifyArguments : false,
    showLogLevel : true,
    showMethodName : true,
    separator: '|',
    showConsoleColors: true
};

Vue.use(VueLogger, options);

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');

Complete error output:

No overload matches this call.
  Overload 1 of 2, '(plugin: PluginObject<{ isEnabled: boolean; logLevel: string; stringifyArguments: boolean; showLogLevel: boolean; showMethodName: boolean; separator: string; showConsoleColors: boolean; }> | PluginFunction<...>, options?: { ...; } | undefined): VueConstructor<...>', gave the following error.
    Argument of type 'typeof import("........../node_modules/vuejs-logger/dist/index")' is not assignable to parameter of type 'PluginObject<{ isEnabled: boolean; logLevel: string; stringifyArguments: boolean; showLogLevel: boolean; showMethodName: boolean; separator: string; showConsoleColors: boolean; }> | PluginFunction<...>'.
      Property 'install' is missing in type 'typeof import("........../node_modules/vuejs-logger/dist/index")' but required in type 'PluginObject<{ isEnabled: boolean; logLevel: string; stringifyArguments: boolean; showLogLevel: boolean; showMethodName: boolean; separator: string; showConsoleColors: boolean; }>'.

  Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>', gave the following error.
    Argument of type 'typeof import("........../node_modules/vuejs-logger/dist/index")' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
      Property 'install' is missing in type 'typeof import("........../node_modules/vuejs-logger/dist/index")' but required in type 'PluginObject<any>'.
};

Any suggestions?

@thomergil
Copy link

I have the same problem.

@thomergil
Copy link

An inelegant solution:

Vue.use(VueLogger as any, options);

@ageddesi
Copy link
Contributor

ageddesi commented Oct 8, 2020

I have just done a pull request that I believe fixes this issue.

@xbill82
Copy link

xbill82 commented Nov 23, 2020

We have the same problem here at Kuzzle and are currently using the same solution as thomergil. Please, merge the PR from @ageddesi 🙏

@justinkames
Copy link
Owner

We have the same problem here at Kuzzle and are currently using the same solution as thomergil. Please, merge the PR from @ageddesi

Let me have a look!

@justinkames
Copy link
Owner

justinkames commented Nov 23, 2020

@ageddesi @xbill82 I merged the PR and released the package as 1.5.5 on NPM.

Can you confirm your issue is solved? Because in my sample TS project it unfortunately isn't.

I'm using

"dependencies": {
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-property-decorator": "^8.4.2",
"vuejs-logger": "1.5.5"
},
"devDependencies": {
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"typescript": "~3.9.3",
"vue-template-compiler": "^2.6.11"

Please let me know ;).

@justinkames justinkames reopened this Nov 23, 2020
@jenow
Copy link

jenow commented Nov 26, 2020

I personally still have the error with 1.5.5

@tsposato
Copy link

I also have the same issue on 1.5.4 & 1.5.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants