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

fix 'Duplicate string index signature' in ProcessEnv #5621

Merged
merged 1 commit into from
Oct 31, 2018
Merged

fix 'Duplicate string index signature' in ProcessEnv #5621

merged 1 commit into from
Oct 31, 2018

Conversation

xiaoxiangmoe
Copy link
Contributor

Fix Error:

TS2374: Duplicate string index signature.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@Timer
Copy link
Contributor

Timer commented Oct 30, 2018

Can you provide a reproducing project please? This issue is not present for me.

@jonathaningram
Copy link

@Timer I am experiencing this too. If the OP doesn't provide a repro, I'll try to.

@Timer
Copy link
Contributor

Timer commented Oct 31, 2018

@jonathaningram can you give me a list of your files in src/? Not nested, just top level.

@jonathaningram
Copy link

@Timer

$ ls -la src/
total 160
drwxr-xr-x  23 jon  staff    736 31 Oct 09:25 .
drwxr-xr-x  18 jon  staff    576 31 Oct 08:28 ..
-rw-r--r--@  1 jon  staff   6148 15 Aug 13:33 .DS_Store
-rw-r--r--   1 jon  staff  10653 31 Oct 09:02 App.tsx
-rw-r--r--   1 jon  staff    894 17 Aug 08:48 DefaultLayout.tsx
-rw-r--r--   1 jon  staff    644 26 Sep 08:43 PrivateRoute.tsx
-rw-r--r--   1 jon  staff   1281 17 Aug 07:02 Routes.tsx
-rw-r--r--   1 jon  staff    174 21 Jun 17:13 UserContext.tsx
-rw-r--r--   1 jon  staff    900 18 Oct 08:45 auth.ts
drwxr-xr-x  22 jon  staff    704 31 Oct 09:00 components
-rw-r--r--   1 jon  staff    100 19 Jun 18:45 element-utils.ts
-rw-r--r--   1 jon  staff    690 17 Sep 08:46 errors.ts
-rw-r--r--   1 jon  staff    659 31 Oct 08:59 index.tsx
-rw-r--r--   1 jon  staff    685 14 Jun 08:17 job.ts
drwxr-xr-x  12 jon  staff    384 17 Aug 06:54 pages
drwxr-xr-x   4 jon  staff    128 11 May 17:16 proto
-rw-r--r--   1 jon  staff     40 31 Oct 09:25 react-app-env.d.ts
-rw-r--r--   1 jon  staff   1345  4 Jul 09:41 rpc.ts
-rw-r--r--   1 jon  staff    408 31 Oct 08:58 styled-components.ts
drwxr-xr-x  11 jon  staff    352 31 Oct 09:00 tenants
-rw-r--r--   1 jon  staff   1884 31 Oct 08:54 theme.ts
-rw-r--r--   1 jon  staff    121  9 Jul 09:10 url.ts

I also tried by removing react-app-env.d.ts and that didn't work either.

Removing [key: string]: string | undefined from node_modules/.../react-app.d.ts does fix the console error—not sure if it's the right way to fix it though but it makes the error go away...

Let me know if I can help any further.

@Timer
Copy link
Contributor

Timer commented Oct 31, 2018

Hmm, very interesting. I was looking for a legacy file in your source tree if you tried the beta, but it isn't present.

Can you please provide a minimal reproducing demo? That's the only way we're going to be able to figure this out.

So far, you two are the only experiencing this issue so I'd like to figure out what's unique about your setup.

@jonathaningram
Copy link

@Timer see https://github.com/jonathaningram/cra-5621

Per the above, if you remove [key: string]: string | undefined from node_modules/react-scripts/lib/react-app.d.ts it will compile.

Note: package.json contains a few (I suspect) unrelated deps. I didn't go as far as trying to remove each of those.

@xiaoxiangmoe
Copy link
Contributor Author

xiaoxiangmoe commented Oct 31, 2018

@Timer

Reproducing Demo

yarn create react-app cra-app --typescript
cd cra-app

then close tsconfig.json's skipLibCheck from

{
  "compilerOptions": {
    "target": "es5",
    "allowJs": true,
    "skipLibCheck": true,

into

{
  "compilerOptions": {
    "target": "es5",
    "allowJs": true,
    "skipLibCheck":false,

@Timer Timer added this to the 2.1.1 milestone Oct 31, 2018
@Timer Timer merged commit e1321e5 into facebook:master Oct 31, 2018
mrmckeb pushed a commit to BeameryHQ/bmr-react-scripts that referenced this pull request Oct 31, 2018
@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants