https://github.com/Microsoft/TypeScript
Revision 1d773a1e09548e319bbff342258eb2a7d003d8ac authored by Nathan Shively-Sanders on 08 October 2018, 19:56:03 UTC, committed by GitHub on 08 October 2018, 19:56:03 UTC
The check for prototype assignment on constructor functions assumes
that the prototype property, if present, comes from an assignment
declaration, such as:

```js
SomeClass.prototype = { /* methods go here */ }
```

In this case, however, when class SomeClass and var SomeClass merge
(because this is allowed), prototype is the synthetic property from
class SomeClass, which has no valueDeclaration.

The fix is to check that prototype has a valueDeclaration before
checking whether the valueDeclaration is in fact a prototype-assignment
declaration.
1 parent 1cfab76
History
Tip revision: 1d773a1e09548e319bbff342258eb2a7d003d8ac authored by Nathan Shively-Sanders on 08 October 2018, 19:56:03 UTC
Fix class/constructor-function merge (#27366)
Tip revision: 1d773a1
File Mode Size
.github
.vscode
bin
doc
lib
scripts
src
tests
.editorconfig -rw-r--r-- 188 bytes
.gitattributes -rw-r--r-- 42 bytes
.gitignore -rw-r--r-- 2.0 KB
.gitmodules -rw-r--r-- 2.0 KB
.mailmap -rw-r--r-- 18.6 KB
.npmignore -rw-r--r-- 312 bytes
.npmrc -rw-r--r-- 18 bytes
.travis.yml -rw-r--r-- 407 bytes
AUTHORS.md -rw-r--r-- 6.0 KB
CONTRIBUTING.md -rw-r--r-- 9.3 KB
CopyrightNotice.txt -rw-r--r-- 819 bytes
Gulpfile.js -rw-r--r-- 26.6 KB
Jakefile.js -rw-r--r-- 33.4 KB
LICENSE.txt -rw-r--r-- 9.0 KB
README.md -rw-r--r-- 4.8 KB
ThirdPartyNoticeText.txt -rw-r--r-- 36.9 KB
package.json -rw-r--r-- 3.5 KB
tslint.json -rw-r--r-- 4.7 KB

README.md

back to top