microsoft / microsoft/TypeScript

JS should allow merging/expando properties on imports

Open
#26,912 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: JavaScript In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

// Filename: mod.js
export const Ns = function () { }

// @Filename: use.js
import { Ns } from './mod'
Ns.expando = 1

Expected behavior:
No error, and Ns has property 'expando'

Actual behavior:
Error, 'expando' not found on 'Ns'.

This merge shouldn't be allowed in Typescript, but it will work in Javascript, so it should be allowed there.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a minimal mod.js/use.js reproduction but names no implementation files or tests. Start by running this example through the TypeScript checker and then trace the diagnostic for property access on the imported Ns binding. Done means JavaScript accepts the expando assignment while TypeScript continues rejecting the equivalent merge.

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
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.