-
Notifications
You must be signed in to change notification settings - Fork 37
Trouble with Init() #52
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
Comments
Well it is a runtime error... Do you actually have [email protected] installed? If you use a debugger, what kind of object is |
Pretty sure I'm running the right version:
Here are the methods I see:
|
No, those are not all methods, as methods are not enumerable. |
I've got this running in a debugger now. What would you like to know about
It doesn't have an |
|
Running this in the REPL works correctly:
It may be a problem with your TypeScript config. Could you tell me which |
The issue is that the static method isn't inherited:
|
Please show me the generated Javascript and your tsconfig.json. |
Thanks for the help! tsconfig.json:
and generated JS for the class: "use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var sequelize_1 = require('sequelize');
var SavedQuery = (function (_super) {
__extends(SavedQuery, _super);
function SavedQuery() {
_super.apply(this, arguments);
}
return SavedQuery;
}(sequelize_1.Model));
var sequelize = new sequelize_1.Sequelize(config.database, config.user, config.password, sqlConfig);
console.log('typeof(SavedQuery)', typeof (SavedQuery));
console.log('typeof(SavedQuery.Init)', typeof (SavedQuery.init));
console.log('typeof(Model)', typeof (sequelize_1.Model));
console.log('typeof(Model.Init)', typeof (sequelize_1.Model.init));
SavedQuery.init({
name: sequelize_1.DataTypes.STRING,
description: sequelize_1.DataTypes.STRING,
author: sequelize_1.DataTypes.STRING,
}, { sequelize: sequelize }); |
The issue is that TS just copies static enumerable properties with This does not happen with |
I think this is relevant? microsoft/TypeScript#1520 |
I'm satisfied that this is WAI from the perspective of typed-sequelize. Feel free to close the issue. My one request would be to document that typed-sequelize@4 is only compatible with |
It is somewhat related. Will you open a new issue and reference it so I can track it? Feel free to do a PR to update the README, preferably with a link to the new issue. |
I wrote code that looks like this:
This type checks fine using [email protected] and [email protected]. But when I run it I get this error:
Is there something I'm missing here? I'm going straight off the test cases.
The text was updated successfully, but these errors were encountered: