microsoft / microsoft/TypeScript
Js file type inference error
Open
Nobody has claimed this yet.
checkJs
In Discussion
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.2.2
Code
person.js
let student = function () {
this.age=12;
}
let person = {};
person.name=22;
student.prototype=person;
let tom = new student();
exports.tom =tom;
test.ts
import * as person from './person';
person.tom.name
Expected behavior: person.tom.name is not an error
Actual behavior:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report using person.js and test.ts with TypeScript 3.2.2, then compare the behavior with a current compiler. Trace how the JavaScript module export and prototype assignment determine the type of person.tom.name. Done means the reported access is accepted without an error, with coverage for this reproduction if the relevant test location is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100