microsoft / microsoft/pxt

Issue with class constructors in python.

Open
#8,490 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
641
Avg merge
12h 4m
Merged PRs (30d)
57

Description

I am having an issue when declaring a class in python. I am getting an error 'Type annotation cannot appear on a constructor declaration' I have not used any type annotation. Another user has identified this as an error with converting the python to typescript

class cord:
def init (self, xCord, yCord):
self.x = xCord
self.y = yCord

Type annotation cannot appear on a constructor declaration.

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

Start by reproducing the provided cord class through the Python-to-TypeScript conversion described in the issue and linked forum thread. Trace where the constructor type-annotation diagnostic is produced; done means this class converts without reporting an annotation that is not present.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.