-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Enable TypeScript strictNullChecks
#35843
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
Conversation
|
Too many |
|
Might be possible to move up the Also, I don't think we should relax any of the |
delvh
left a comment
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 apart from the regression
- Update JS deps - Regenerate SVGs - Fix air `bin` deprecation - Fix `monaco.languages.typescript` deprecation - Remove `eslint-plugin-no-use-extend-native`, it's unnecessary with typescript - Enable new `@typescript-eslint` rules - Disable `@typescript-eslint/no-redundant-type-constituents`, this rule has bugs when not running under `strictNullChecks` (pending in #35843).
* origin/main: [skip ci] Updated translations via Crowdin Fix bug when updating user email (go-gitea#36058) Add "Go to file", "Delete Directory" to repo file list page (go-gitea#35911) Replace `lint-go-gopls` with additional `govet` linters (go-gitea#36028) Fix Actions `pull_request.paths` being triggered incorrectly by rebase (go-gitea#36045) Fix error handling in mailer and wiki services (go-gitea#36041) Update JS deps, fix deprecations (go-gitea#36040) Fix incorrect viewed files counter if file has changed (go-gitea#36009)
|
@wxiaoguang for some reason you comments show up on the wrong lines. Can you correct them? |
GitHub's bug: |
|
FYI comments show correctly in this link: d6dc25a |
Co-authored-by: delvh <dev.lh@web.de> Signed-off-by: silverwind <me@silverwind.io>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
|
Now the remaining problem (not in this PR's scope) is: how to handle the strict types clearly. In our case, most are caused by |
Generally I prefer to code defensively and stop the current operation, e.g. For cases where one is absolutely sure a element exists, |
I think some util functions can help: In the |
|
Generally I prefer to use as few such wrappers as possible, and I don't see a major benefit in using such |
Without this approach, some bugs will be difficult to find. For example: some |
|
Yes, I noticed typescript does not complain about things like |
|
Relevant rule is: https://typescript-eslint.io/rules/restrict-template-expressions/ with |
* giteaofficial/main: Enable TypeScript `strictNullChecks` (go-gitea#35843) Update go toolchain to 1.25.5 (go-gitea#36074) Revert "adopt changes" (was intendet for go-gitea#33356) adopt changes

A big step towards enabling strict mode in Typescript.
There was definitely a good share of potential bugs while refactoring this. When in doubt, I opted to keep the potentially broken behaviour. Notably, the
DOMEventtype is gone, it was broken and we're better off with type assertions one.target.