* First draft:in js, constructor declaration is preferred * Add tests * initializer of null|undefined gives any in JS Also move this-assignment fixes out of binder. I'm going to put it in the checker instead. * In JS, initializer null|undefined: any, []: any[] * First draft of js prefer-ctor-types overhaul * Update tests, update baselines * Improve readability of constructor-type preference * Cleanup: Remove TODO and duplication * Add noImplicitAny errors * Add comment
17 lines
426 B
TypeScript
17 lines
426 B
TypeScript
// @allowJs: true
|
|
// @checkJs: true
|
|
// @noEmit: true
|
|
// @strictNullChecks: true
|
|
// @Filename: npm-install.js
|
|
function Installer () {
|
|
this.args = 0
|
|
}
|
|
Installer.prototype.loadArgMetadata = function (next) {
|
|
// ArrowFunction isn't treated as a this-container
|
|
(args) => {
|
|
this.args = 'hi'
|
|
this.newProperty = 1
|
|
}
|
|
}
|
|
var i = new Installer()
|
|
i.newProperty = i.args // ok, number ==> number | undefined
|