Uncaught TypeError: Cannot call a class as a function @ v0.5.2 / v0.5.3
See original GitHub issueWhen 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:
- Created 7 years ago
- Comments:21 (17 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed in 0.5.4
Doesn’t print any red line in my project’s console ~