<!-- 🚨 STOP 🚨 STOP 🚨 STOP 🚨 Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Even if you think you've found a *bug*, please read the FAQ first, especially the Common "Bugs" That Aren't Bugs section! Please help us by doing the following steps before logging an issue: * Search: https://github.com/Microsoft/TypeScript/search?type=Issues * Read the FAQ: https://github.com/Microsoft/TypeScript/wiki/FAQ Please fill in the *entire* template below. --> <!-- Please try to reproduce the issue with the latest published version. It may have already been fixed. For npm: `typescript@next` This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly --> **TypeScript Version:** 3.9.7 <!-- Search terms you tried before logging this (so others can find this issue more easily) --> **Search Terms:** this, alias **Code** ```ts repro // @filename: a.js var libObjects = {} libObjects.dataService = function (url) { var scope = this; /** * updates some data */ scope.updateData = function () { //... } /** * stop all processing */ scope.disable = function () { //... } } // @filename: b.js var service = new libObjects.dataService(""); service // ^? ``` **Expected behavior:** `service: dataService` and should offer `updateData` and `disable` in completion. **Actual behavior:** `service: any` **Playground Link:** [Workbench Repro](https://www.staging-typescript.org/dev/bug-workbench/?#code/PTAEAEDMEsBsFMB2BDAtvAXKZA6AVgM4BQAbsgE6izQBGA8jXvAMYAuBoAvKAN4C+RItXqMW7HABNkrZAGV45EtGbwuoSAFdEbaAHtEoABQbysAJS8iASDKUCzXQAdV3VgAtoBANyCrwAFT+1qD+oBqOUqzwHAS66KCRyMH+wNb2TvA44ZHwACLSyGqa2qx6BoYWPNZ+wDh11gLWAUFWIaAErE7YsLCgjuS6KgQE0IgA5smpVunOkp7INAhFWjr6RpXVIHU4DUSNIBAwCCjoWDT4xLbtCkoqaojwAO5UtAxMbASSBfKKyvCGACIAWYfAQbn8iAdQKAAHoAfiAA) **Related Issues:** <!-- Did you find other bugs that looked similar? --> #36618