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
tns-platform-declarations 2.3.0 ERROR on build [iOS] #2724
Comments
UIEvent is present both in the dom .d.ts in the typescript package and in iOS there is an UIEvent. |
references.d.ts
tsconfig.ts
|
Even after appending the above code, I get more errors,
|
Me too... |
Has anyone found a way to resolve this. I have spent days trying to do so in vain :( |
Sorry, I gave up and removed the declaration file... maybe you can try installing nativescript@next to check if it's fixed there... |
I change my Also, I set Before
After
|
Hopefully, this should resolve the issue. references.d.ts
Notice how I referenced tsconfig.json
Notice I how I included This resolved the issue for me. |
@holymp2006 I tried your solution and it worked but only if I put
With This is my tsconfig.json:
How can I solve this? |
@bm-software I haven't experienced this. Maybe because I don't use angular. |
@holymp2006 Unfortunately also setting |
@bm-software like I said, unfortunately, I don’t use angular. So, I might not be able to help you resolve this fully. Maybe someone else with more experience with declarations will come along. Meanwhile, see if this answer on SO gives you any pointers. |
this is what fixed it for me, in tsconfig.json setting edit - however after doing so i noticed that VS cant find function, alert, and many other terms like this. It still runs, abut throws errors in VS where it should not be. Anyone have a fix for this? (this is because of "noEmitOnError": false,) |
@SamuelGRwebfab This "solve" the issue (iOS errors are obviously still present). I can build and run my project but now, if I run my prject with livesync, including tns-platform.declarations file, node launches the exception Is there any solution to this? |
@bm-software For now i have removed my IOS reference because of this issue. Untill i find a proper solution. Sorry I cant point you in the right direction. If i find an answer I will post it here, but I imagine someone will find it before me. |
I'm experiencing the same issue with the upgrade to Nativescript 2.3.0. |
anyone found a fix for this yet? |
Does anyone know how to correctly use the type definitions from NativeScript? I've tried every solution offered here and nothing works, always compilation errors like |
Hey @joshcomley , @SamuelGRwebfab , @corne-de-bruin @bm-software As a workaround add this to your references.d.ts
and your tsconfig.json should look like this:
The solution above is assuming you are creating NativeScript + Angular-2 application which is using NativeScript 2.4.0 and tns-platform-declarations 2.4.0 |
I just tried this work around and its throwing even more errors (copied your code exactly except i have a reference for firebase as well). My IDE is giving me an error on each declared type saying duplicate identifier. Here is the console error (not all of it) node_modules/tns-core-modules/weakmap.d.ts(11,13): error TS2403: Subsequent vari
|
Hey @SamuelGRwebfab can you paste the content of your package.json, tsconfig.json and references.d.ts ? Note that you should have tns-core-modules 2.4.0 as a minimum version for this to work. We have created sample Angular-2 application which you can use as a reference. In this application, we are using tns-platform-declarations with the solution posted above. |
Hey @NickIliev Thanks for the workaround! Since we are using rxjs: 5.0.0-beta12 we also had to include the following type declares: |
Hey @NickIliev, Your changes fix our TSC errors but we're still experiencing
When using both android & iOS typings and --watch |
Hey @NickIliev, This is my package.json
tsconfig.json
references.d.ts
Thanks for the help! |
I was able to get my TSC to work (and it seems like everything else) by going into the app folder, then in the references.d.ts INSIDE OF THE APP FOLDER not root, change the reference to Do not add the other references, this should be the only reference in the file. If I find that this causes any issues i will post an update, hopefully with a fix for what ever issues crop up |
@SamuelGRwebfab can you please post the content of your |
@alixandru of course. Sorry for the delay tnsconfig
references (outside of app folder) ` /// references (inside app folder)
tsconfig (inside app folder)
this also may help. `{
}, I hope this helps! (seems github doesn't like these files much, sorry for the bad formatting but I cant seem to fix it. it is literally removing code for no reason ) |
This worked for me trying (using nativescript-angular 2.5.2): Add this line to the file accessing the native API: Ex.:
My ts.config.json looks like this:
My I am now able to build the app and everything works as expected. |
No luck. I tried both suggestions and neither worked. I gave up and went on using |
@elinswilberg Do you mean tns-platform-declarations version 2.5.2? What version of tns-=core-modules, 2.5.2 as well? nativescript-angular is still version 1.4 |
3 declare class Request { node_modules/tns-core-modules/declarations.d.ts(56,15): error TS2300: Duplicateidentifier 'Response'. 78 declare type BodyInit = Blob|FormData|string; node_modules/tns-core-modules/declarations.d.ts(78,14): error TS2300: Duplicateidentifier 'BodyInit'. 79 declare type RequestInfo = Request|string; node_modules/tns-core-modules/declarations.d.ts(79,14): error TS2300: Duplicateidentifier 'RequestInfo'. 5313 headers?: any; type 'string[] | Headers | { [index: string]: string; }', but here has type 'any'. type 'BodyInit', but here has type 'any'. type 'RequestMode', but here has type 'string'. be of type 'RequestCredentials', but here has type 'string'. type 'RequestCache', but here has type 'string'. node_modules/typescript/lib/lib.d.ts(5329,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'headers' must be of type 'HeaderInit', but here has type 'any'. 5329 headers?: any; 11168 interface Headers { 11177 declare var Headers: { 13566 interface Request extends Object, Body { 13583 declare var Request: { 13588 interface Response extends Object, Body { node_modules/typescript/lib/lib.d.ts(13588,11): error TS2300: Duplicate identifier 'Response'. 13599 declare var Response: { 17714 readonly bodyUsed: boolean; 19121 type BodyInit = any; 19152 type RequestInfo = Request | string; |
There were few conflicting classes such as UIEvent that we renamed to _UIEvent by hand (this means there API is now incorrect in the cases of iOS classes prefixed by _) but the tns-platform-declarations will build correctly event with dom definitions included. (e.g. UIEvent from dom and from UIKit won't clash). Now you can install the declarations like |
still have the same problem |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Adding the latest tns-platform-declarations throws with
Also a breaking change to the ios.d.ts path has been introduced and the path now is
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios/ios.d.ts" />
compared to the path in 2.2.0
/// <reference path="./node_modules/tns-platform-declarations/tns-core-modules/ios.d.ts" />
The text was updated successfully, but these errors were encountered: