Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript has problem compile RS --es6 output at class attributes #213

Open
mozbugbox opened this issue Dec 12, 2019 · 2 comments
Open

Comments

@mozbugbox
Copy link

Test:

class Test:
    def __init__(self):
        self.value1 = null
    def method(self):
        self.value1 = 0
$ npx rapydscript -p -6 typescriptKlass.pyj > typescriptKlass.ts
$ tsc --lib es7 typescriptKlass.ts 
typescriptKlass.ts:26:18 - error TS2339: Property 'value1' does not exist on type 'Test'.

26             self.value1 = null;
                    ~~~~~~

typescriptKlass.ts:30:18 - error TS2339: Property 'value1' does not exist on type 'Test'.

30             self.value1 = 0;
                    ~~~~~~


Found 2 errors.

It seems that the attributes need to be decleared at the scope of class first for typescript.

BTW: It would be great to transcompile to type annotated typescript code.

@valq7711
Copy link
Collaborator

valq7711 commented Dec 12, 2019

RS has its own type-annotation, why do you need TS?

@mozbugbox
Copy link
Author

Some 3rd party projects use typescript. I want to include RS libs I wrote to the projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants