Building at the Appflow gives lot of TypeScript errors. This is since the build is far from final, and the typescript cleaning is purposefully left for another time. How can I tell the compiler to ignore all typescript errors? Simply having as development build does not help. The result is, that at localhost all builds succesfully without errors, but at Appflow there is many TS errors.
you don’t, you fix the errors. You shouldn’t be leaving it behind.
Sure thing, when publishing or reaching certain milestone in dev.
But as it happens with localhost, while still developing, one can build without fixing those. So there should also be option for that at the Appflow, atleast when building development version. It is then meant for “own use”, not publicly available. Anyway, they are mostly things like unused variable (which might lay there for use later when writing those still unwritten functions), and so they don’t bother when running ionic build locally, or ionic cap run android.
Thus, such an option would save development time.
But if there isn’t one it’s a pity. Then one needs to look for another similar solution, i.e. to build native binaries to test on devices. Of course they can be made locally, but I understood that it was one of the Appflow’s cornerstones, to automate that. If it lacks that feature, it is maybe still good at the endgame, but not during the dev process. As a fellow developer just asked few minutes back, do we need appflow then at all, if we anyway need to do those manually locally.
Per the other poster, we don’t recommend ignoring TypeScript errors because it’s there to identify issues immediately before they turn into larger headaches.
That said, you can control how Appflow builds the app. It uses the
build script defined in package.json (or there’s an alternative Appflow-only command). You’ll see the results of the
npm run build command in the build log. So, this isn’t really an “Appflow concern” but rather relates to the web project and/or TypeScript configuration.
It looks like you can turn off error checking in the
tsconfig file. See here.
Thank for comments for both. The problem still remains though. When running the build at localhost, there is no errors, even though it is running the same build script mentioned in the package.json as netkow pointed out. So it happens only at Appflow.
In tsconfig.json I already had “noEmit”: true but as mentioned at the linked I also added “noEmitOnError”: true. Same results. Also tried with both as false as also that post suggests. Still same results, ok at locahost, but not ok at AppFlow.
As for the matter of ignoring the TypeScript erros, I disagree a bit. I too think it is important to clean them, but doing so at every step, before every minor change / build / test slows down production quite much. For example, when you just need to show the current status to UI designer to ask their opinion, it is not vital that every unused variable has been cleaned, it should be enough if there is no errors preventing the application or at least he page in question to run. However, when reaching certain milestone during development, like after creating the new feature, or when looking forward to publish it even just to interest parties, then it is good to clean it up also form those unused variables or other similar less-vital TypeScript errors. Like stated, they can come problem in the long run and cause headaches. But when just about to show the work to colleague or just to test things a bit out for something for your own development, or any other reason to run build -command, cleaning every minor such eslint or typescript or such error might be counter-productive. Just like in construction sites, they do not clean the room under construction or renovation every hour, they clean it in intervals and between different points of the work. Then again, this is of course matter of coding style. Both may result in the end for the same: clean code with no typescipt or other errors.
OK apologies, I missed above when you wrote “mostly things like unused variables.” I agree, warnings are OK to ignore during development.
If you see TypeScript warnings in the Appflow build log, you can safely ignore them. If you see TypeScript errors preventing your build from completing successfully, that’s a different story. I suggest reaching out to our support team: firstname.lastname@example.org.
Thanks, I will reach out to ionic support. They are not only warnings, there are also errors like
error TS2322: Type ‘string | null | undefined’ is not assignable to type ‘string | undefined’
error TS7006: Parameter ‘phoneNumber’ implicitly has an ‘any’ type
But still, if it can be built at localhost, and also for mobiles and for example run it without problems in real mobile devices as well, I guess it should be able to go through the build process of Appflow too. But I will reach out to the email@example.com to see if they can be bypassed also at Appflow somehow.