Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Typewiz error on overloaded functions in this simple create-react-app repro #85

Closed
zxti opened this issue Dec 3, 2018 · 4 comments
Closed
Assignees
Labels
bug Something isn't working component:core

Comments

@zxti
Copy link

zxti commented Dec 3, 2018

I've gotten a taste of typewiz by running some of my codebase in node, and it's awesome! But now when I turned to run it over the create-react-app-based codebase, I'm seeing errors when encountering exported function overloads, for some reason (which I didn't see occur in typewiz-node, oddly).

I've created a repro of this, which requires the following two repos:

To get started, clone both repos, then run:

cd react-scripts-ts
yarn link
yarn install
cd ../cra-typewiz-example
yarn link react-scripts-ts
yarn install
yarn start

When the dev server starts, it spits out the error:

./src/App.tsx 6:16
Module parse failed: Identifier 'foo' has already been declared (6:16)
You may need an appropriate loader to handle this file type.
| import logo from "./logo.svg";
| export function foo(x) { }
> export function foo(x) { }
| export function foo(x) { }

Any ideas around this? I hope my creating these repos helps!

@urish urish self-assigned this Dec 3, 2018
@urish
Copy link
Collaborator

urish commented Dec 3, 2018

Thanks for creating a reproduction repo, I'm going to look into this

@urish urish added bug Something isn't working component:core labels Dec 3, 2018
@urish
Copy link
Collaborator

urish commented Dec 3, 2018

Reproduced with the following test case (in instrument.spec.ts):

    it('should not instrument a function declaration that has no a body', () => {
        // See issue #85 for details
        const input = `function foo(n: number): void;`;
        expect(instrument(input, 'test.ts')).toContain(
            astPrettyPrint('function foo(n: number): void;'),
        );
    });

@urish urish closed this as completed in b5339a6 Dec 3, 2018
@urish
Copy link
Collaborator

urish commented Dec 3, 2018

Fix released as typewiz 1.2.3

@zxti
Copy link
Author

zxti commented Dec 4, 2018

Fast work! Works perfectly now. Can't wait to get this going again. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working component:core
Projects
None yet
Development

No branches or pull requests

2 participants