microsoft / microsoft/pxt-microbit

converting nested namespaces from Python to typescript loses code

Open
#3,196 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2 python pyToTs tsToPy
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

This python:

@namespace
class foo:
    baz = 42
    @namespace
    class bar:
        baz2 = 86

converts to this typescript:

namespace foo {
    export const baz = 42
    
}

which lost "bar" and "baz2" completely.

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

Reproduce the issue with the nested namespace Python example and inspect the Python-to-TypeScript conversion path. Confirm that the generated TypeScript retains both the nested bar namespace and baz2 value; done means no nested code is lost during conversion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.