-
Notifications
You must be signed in to change notification settings - Fork 202
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
Multiple duplicate identifier while tsc #551
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Has there been any movement here? I'm trying cloud functions for the first time and getting the same error when deploying functions only. Thanks. |
I have similar issue where I get
|
I solved this personally by explicit adding a devDependency for @types/node.
On Mon, Sep 9, 2019, at 4:11 PM, Łukasz Byjoś wrote:
I have similar issue where I get
***@***.***/node/index.d.ts:187:11 - error TS2300: Duplicate identifier 'IteratorResult'.
187 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
~~~~~~~~~~~~~~
node_modules/@types/node/index.d.ts:187:11
187 interface IteratorResult<T> { }
~~~~~~~~~~~~~~
'IteratorResult' was also declared here.
Found 2 errors.
`
… —
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#551?email_source=notifications&email_token=AAGG6ALCHUJE5PDF7GORFMDQI23W5A5CNFSM4IQFBLSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6JBUIA#issuecomment-529668640>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAGG6AOUTL74MQNSDNTXELLQI23W5ANCNFSM4IQFBLSA>.
|
As you can see the /functions/package.json already has a dev dependency for it. So this does not solve my issue. |
Getting similar after taking advice from the warning and updating to the latest version of firebase-functions. First I had the array error which was solved by updating Typescript |
Same problema here, tried with different versions of firebase tool and typescript, tried to deploy but get error Function package json Error 169 interface IteratorResult { } |
Same problem here, started a new project becouse my old project i was getting an issue with firebase deploy --only functions `node_modules/@types/node/index.d.ts:178:11 - error TS2300: Duplicate identifier 'IteratorResult'. 178 interface IteratorResult { } node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'. 41 type IteratorResult<T, TReturn = any> = IteratorYieldResult | IteratorReturnResult; node_modules/@types/node/index.d.ts:178:11 |
UPDATING finally managed to deploy after a while on google searching, below my package and tsconfig: package.json |
I faced this issue after installing styled-components typescript definitions in my project. They have a dependency for @types/react-native (which is weird for a web project). I fixed it by fixing @types/styled-components to 4.1.8. |
Thanks @atouzel ! I faced the same issue too. It fixes this 👍 |
@mahlm you just saved me a ton of headache! |
@mahlm Saved my life |
@mahlm You're the man |
This solves to me!! |
@mahlm Your suggestion worked for me, thanks! 😄 |
Did you do this in your root project, or in the functions folder?
|
Closing this out @NikoMontana please re-open if the suggestions above did not work for you. |
Thanksss. |
Wow, it worked like a charm. But could some one please explain why we have to do this? |
The fix mentioned here: firebase/firebase-functions#551 (comment) is required even in a fresh install of `firebase init functions` and the option mentioned as the solution should be included in the `tsconfig.json` template by default.
Why isn't this in the default template already? |
I confirm that for me it worked adding
to and
to to |
I had an issue whereby I was including the types from the top level project, for unit testing. Luckily I just had to include the test in the exclude definition and it compiled. {
"include": ["src"],
"exclude": ["**/*.test.ts"],
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"outDir": "lib",
"strict": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"sourceMap": true,
"types": ["jest"],
"typeRoots": ["node_modules/@types"]
}
} |
You mean |
I can also confirm that updating my I added
|
For me the solution was to install both |
I don't know the consequences , but it works. |
Related issues
#404
[REQUIRED] Version info
node:
v10.15.3*
firebase-functions:
^3.1.0
firebase-tools:
7.2.4
firebase-admin:
^8.0.0
[REQUIRED] Test case
firebase init
package.json
[REQUIRED] Steps to reproduce
Refer to Test case
[REQUIRED] Expected behavior
Upload functions - don´t throw tsc errors
[REQUIRED] Actual behavior
Were you able to successfully deploy your functions?
No. I tried everything that was suggested in the referenced issue. Working on a monorepo with nextjs. The only thing that saves my day is
"skipLibCheck": true
forfunctions/tsconfig
- but this comes with some real downsides. Also tried to deletepackage.json.lock
andnode_modules
and reinstall.Project structure
package.json @root
tsconfig.json @root
/functions/tsconfig.json
/functions/package.json
I am assuming that this error comes from running a typescript monorepo, where the frontend is using a tsconfig and the functions also require it. So it happens that by running
firebase deploy --only functions
from the root dir of the whole projecttsc
refers tonode_modules
of the root and loads already the react types. Clearly visible if you take a look at the paths from the error messages.The text was updated successfully, but these errors were encountered: