-
Notifications
You must be signed in to change notification settings - Fork 41
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
chore(ts): small tweaks to make typescript happier #137
Conversation
isaacs
commented
Apr 28, 2023
- Use trimStart/trimEnd instead of deprecated trimLeft/trimRight
- Target es2019, which is when trimLeft/Right/Start/End methods became available (at least according to tsc)
These changes look reasonable, but under what circumstances does TypeScript complain? (I am not seeing any messages from running |
The ts server in neovim warned about them. Maybe I have a different typescript version or something? Or it could be using ts lint? I've found its advice is usually pretty good. |
https://exploringjs.com/es2018-es2019/ch_array-prototype-trimstart-trimend.html
Node.js has |
The Typescript configuration docs mention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The change to target makes this semver major, but I expect we'll be doing a release to drop node 12 (and maybe 14 too) at some point anyway.
Still don't understand the warning situation
I finally managed to get some warnings from tsc compile by removing
So Typescript is happy when used directly, and I suspect the ts-server (or tslint) in your neovim setup is using somewhat different configuration, or ignoring node context. |
Dropping everything before 14 at least is a good idea. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am ok with changing trim calls, but I do not want to change target
in tsconfig.json
without a clear idea what scenario that benefits.
- Use trimStart/trimEnd instead of deprecated trimLeft/trimRight
subsumed in #139, closing this one so I can make some changes on my main branch. |