Is not a big problem, I will just fix the code in this case.
But I would like the option to turn it off, one of the fundamental principals of Typescript is incremental adoption. A warning at compilation should be an option, because I rather have a warning of something that I made wrong than just changing from .ts to .js and never see the error again.
For example: the documentaion on how to deploy it to Heroku has a problem with database.ts, it does not compile:
Starting the compilation for TypeScript files in /tmp/build_33a462b5
config/env/production/database.ts:3:47 - error TS1005: ';' expected.
3 import parse = require('pg-connection-string').parse;
~
config/env/production/database.ts:4:16 - error TS2349: This expression is not callable.
Type 'typeof import("/tmp/build_33a462b5/node_modules/pg-connection-string/index")' has no call signatures.
4 const config = parse(process.env.DATABASE_URL);
~~~~~
Found 2 error(s).
Is a copy and paste from the documentation, and I don’t feel like diving into it right now, so I just switched to database.js and the error is gone for ever. I would have like to leave the warning on.
Sometimes you will deal with external factors that you can’t control (like third party dependencies), and not being able to build your app because some parameter can be null even thought you know that is totally fine seems like a radical approach.
And now consider that I have an already existing app that has 3 years and that I have to migrate, here is when incremental adoption becomes a deal breaker.
Sorry to sound a bit pissed off, I have been changing gradually all the .js to .ts because if not the app doesn’t work, I was expecting a softer landing, but now that I’m already half way I will just try to finish it.
Outside of that I’m so daim happy that Typescript finally arrived to Strapi, that is why I’m starting the migration now even if the documentation says that I shuldn’t do it right now.