Skip to content

Commit

Permalink
feat(cdk): update tsconfig to more modern settings in typescript init…
Browse files Browse the repository at this point in the history
… templates (#31927)

### Issue # (if applicable)

n/A

### Reason for this change

I think contents of `tsconfig.json` are a little outdated and seemed to need update.


### Description of changes


The following two changes I made:

1. Removed unnecessary options
2. Updated `target` and `lib` options at compilerOptions

#### 1. Removed unnecessary options

Unnecessary options included in the `compilerOptions` of tsconfig.json.   
The unnecessary options are as follows

- noImplicitAny
- strictNullChecks
- noImplicitThis
- alwaysStrict


If `strict: true` is specified in compilerOptions, these options will also be `true`, so there is no need to specify them.

see: https://www.typescriptlang.org/tsconfig/#strict


#### 2. Updated `target` and `lib` options at compilerOptions

- target
  - I think 'ES2023' is more appropriate for the target option at this point.
- lib
  - Basically, it doesn't seem necessary to specify the same value for the lib option as the target specified in the target option.
  - see: https://www.typescriptlang.org/tsconfig/#lib


### Description of how you validated changes



### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
ren-yamanashi authored Oct 30, 2024
1 parent 33a4a5d commit 8e4c247
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2022",
"module": "commonjs",
"lib": [
"es2020",
"ES2023",
"dom"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2022",
"module": "commonjs",
"lib": [
"es2020",
"ES2023",
"dom"
],
"declaration": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
Expand Down

0 comments on commit 8e4c247

Please sign in to comment.