Build (all): simplify and revisit tsconfig files & settings
Description of the feature request
Right now the tsconfig files located in the folder of each utility (Logger, Metrics, Tracer) have repeated settings with some differences.
Example: resolveJsonModule in the Logger utility, but there might be others.
Would be good to revisit the current tsconfig setup and the way we transpile our code.
Problem statement
Inconsistent, potentially unnecessary tsconfig settings across the same utility and different utilities.
Summary of the feature
Simplify tsconfig files & settings.
Code examples
I like the way the AWS SDK v3 does it, extending one another: https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3
Benefits for you and the wider AWS community
Simplification and better governance.
Describe alternatives you've considered
N/A
Additional context
This issue affects all existing utilities.
Related issues, RFCs
Hi @saragerion! as far as I have understood, this issue is regarding making one common file for tsconfig for all three folders(Logger, Metrics, Tracer) which has similar settings, and extend individual/different settings in each of the folder through new tsconfig files. ryt? please let me know if I'am missing something here :) Thanks!
@goverdhan07 thanks for commenting the issue, I understand that what you're mentioning is correct but there might also be some settings in the tsconfig.json files that are unnecessary and that might be possible to remove. Ideally we'd need to go through all of them, extend when possible and remove when redundant.
Also note that there are some additional tsconfig files like tsconfig-dev.json and tsconfig.es.json. If they are not needed, they could be deleted. And another note: tsconfig.json only includes "src/**/*" but not tests, so all the compiler settings (like e.g. "strict": true) won't be applied to the test code which is a bit unfortunate (e.g. no consistent live linting in VSCode for tests).
Not sure if related, but in #1373, and specifically in point 4 of the issue it's mentioned that even though strict: true is applied in the config, interfaces are not flagging errors when a class that implements them does so incorrectly, i.e.:
const MetricUnit = {
Bites: 'Bites'
} as const;
type MetricUnit = typeof MetricUnit;
interface MetricsInterface {
addMetric(name: string, unit: MetricUnit, value: number): void
}
class Metric implements MetricsInterface {
// Should show an error saying that `addMetric` is not compatible with the one defined in the interface
public addMetric(name: string, unit: MetricUnit, value: number, resolution: string): void {
console.log(name, unit, value);
}
}
Additionally, I have looked into this:
Also note that there are some additional tsconfig files like tsconfig-dev.json and tsconfig.es.json. If they are not needed, they could be deleted. And another note: tsconfig.json only includes "src/**/*" but not tests, so all the compiler settings (like e.g. "strict": true) won't be applied to the test code which is a bit unfortunate (e.g. no consistent live linting in VSCode for tests).
The reason why we have these separate config files that selectively include the tests are that we want both src/**/* and tests/**/* to be part of the config but we want only the content of src to be included in the build output. We could however simplify the setup and override only that setting like suggested in the OP.
⚠️ COMMENT VISIBILITY WARNING ⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
This is now released under v1.13.0 version!