question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: Cannot call a class as a function @ v0.5.2 / v0.5.3

See original GitHub issue

When with v0.5.1 it’s all good.

The error was caused here:

_classCallCheck(this, HelloComponent); // then

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {  // false here
    throw new TypeError("Cannot call a class as a function");
  }
}

I compared the built code and the only difference is:

// v0.5.1 (working)

function decorate(cls) {
  Component.inDefinition = true;
  // workaround flow inference
  var instance = undefined;
  try {
    instance = new cls();
  }
  finally {
    Component.inDefinition = false;
  }
// v0.5.2 (broken)

function decorate(cls) {
  Component.inDefinition = true;
  var instance = Object.create(Vue.prototype);
  Object.defineProperty(instance, '_init', {
    value: util_1.NOOP, enumerable: false
  });
  try {
    cls.call(instance); // this calls _classCallCheck
  }
  finally {
    Component.inDefinition = false;
  }

I’m using vue@2.0.5, vue-loader@9.9.1 I’m not using vue-ts-loader, but awesome-typescript-loader and separated template like below:

<style lang="sass" src="./app.component.sass" />
<template lang="pug" src="./app.component.pug" />
<script lang="ts" src="./app.component.ts" />
import { Vue, Component } from 'av-ts'

@Component({
  name: 'app',
})
export default class AppComponent extends Vue {
}

I’ve put my code here: https://github.com/whitetrefoil/vue-ts-arch/tree/av-ts-052

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
HerringtonDarkholmecommented, Nov 18, 2016

Fixed in 0.5.4

0reactions
whitetrefoilcommented, Dec 2, 2016

Doesn’t print any red line in my project’s console ~

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Cannot call a class as a function" in my React Project
My instance of this error was simply caused because my class did not have a proper render method. Share.
Read more >
Changelog | Meteor API Docs
Simple run meteor update in your app. Great new features and no breaking changes (except one package deprecation). You can always check our...
Read more >
Groupy Documentation - Read the Docs
Groupy supports the entire GroupMe API. . . plus one or two undocumented features. • list current and former groups. • create, update,...
Read more >
About this Documentation Node.js v6.3.1 Manual & Documentation
Legacy Streams API (pre Node.js v0.10); Recent ECDH Changes; Support for weak ... V8 provides the mechanisms for creating objects, calling functions, etc....
Read more >
node_modules/karma/CHANGELOG.md · master · Zahra ...
cli: Karma is more strict and will error out if unknown option or argument is passed to CLI. Using Karma to run Dart...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found