Skip to content

Remove and forbid @ts-expect-error#36513

Merged
wxiaoguang merged 26 commits intomainfrom
copilot/remove-ts-expect-error
Feb 1, 2026
Merged

Remove and forbid @ts-expect-error#36513
wxiaoguang merged 26 commits intomainfrom
copilot/remove-ts-expect-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 1, 2026

Removes @ts-expect-error in the code base and forbids it.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 1, 2026
Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove @ts-expect-error and update type definitions Remove all @ts-expect-error suppressions from web_src/js Feb 1, 2026
Copilot AI requested a review from silverwind February 1, 2026 10:56
@silverwind silverwind changed the title Remove all @ts-expect-error suppressions from web_src/js Remove all @ts-expect-error suppressions from web_src/js Feb 1, 2026
Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>

This comment was marked as off-topic.

Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>

This comment was marked as off-topic.

@silverwind silverwind marked this pull request as ready for review February 1, 2026 11:48
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 1, 2026
@silverwind
Copy link
Copy Markdown
Member

Ok everything is addressed.

@silverwind silverwind marked this pull request as ready for review February 1, 2026 13:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes all instances of @ts-expect-error comments from the TypeScript codebase and adds an ESLint rule to forbid their future use. The changes involve replacing @ts-expect-error with proper type assertions (using as unknown as), adding type declarations for third-party modules without types, and making minor adjustments to handle TypeScript type issues.

Changes:

  • Enabled ESLint rule to forbid @ts-expect-error and added webworker lib to TypeScript configuration
  • Added comprehensive type declarations for external modules (asciinema-player, citation-js, vue-bar-graph, mcaptcha) in types.d.ts
  • Replaced all @ts-expect-error comments with proper type assertions using as unknown as pattern or fixed underlying type issues

Reviewed changes

Copilot reviewed 19 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
eslint.config.ts Enabled ban on @ts-expect-error and fixed type assertions for plugin imports
tsconfig.json Added webworker lib for SharedWorkerGlobalScope support
types.d.ts Added type declarations for external modules previously suppressed with @ts-expect-error
web_src/js/globals.d.ts Moved module declarations to types.d.ts and added MessageEvent.ports interface extension
web_src/js/webcomponents/polyfills.ts Added type assertions for incomplete Intl.NumberFormat polyfill
web_src/js/modules/sortable.ts Changed parameter type to HTMLElement and added type assertion for import
web_src/js/markup/asciicast.ts Added non-null assertion for required attribute
web_src/js/features/tribute.ts Added type imports and assertions, changed noMatchTemplate to function
web_src/js/features/repo-settings-branches.ts Added type assertion for querySelector result
web_src/js/features/repo-settings-branches.test.ts Changed type assertion from as to as unknown as
web_src/js/features/repo-projects.ts Added type assertions for querySelector results
web_src/js/features/repo-issue-list.ts Added type assertion for querySelector result
web_src/js/features/repo-diff.ts Replaced @ts-expect-error with as any for form nullification
web_src/js/features/eventsource.sharedworker.ts Added SharedWorkerGlobalScope cast and fallback for MessageEvent.ports
web_src/js/features/citation.ts Removed @ts-expect-error comments for imports (types now in types.d.ts)
web_src/js/features/captcha.ts Removed comment, allows mutation via type declaration
web_src/js/components/*.vue Added custom type definitions and replaced type suppressions with proper assertions
web_src/js/bootstrap.ts Added type assertion for error handler array iteration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silverwind
Copy link
Copy Markdown
Member

Did some more refactors on tribute types. Not entirely clean but better than before. Still working fine for emoji and mentions.

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 1, 2026
@wxiaoguang wxiaoguang merged commit 7883f6d into main Feb 1, 2026
28 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Feb 1, 2026
@wxiaoguang wxiaoguang deleted the copilot/remove-ts-expect-error branch February 1, 2026 17:00
bircni pushed a commit to bircni/gitea that referenced this pull request Feb 1, 2026
Removes `@ts-expect-error` in the code base and forbids it.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 2, 2026
* giteaofficial/main: (26 commits)
  [skip ci] Updated translations via Crowdin
  Remove and forbid `@ts-expect-error` (go-gitea#36513)
  Add resolve/unresolve review comment API endpoints (go-gitea#36441)
  Fix incorrect vendored detections (go-gitea#36508)
  Bump alpine to 3.23, add platforms to `docker-dryrun` (go-gitea#36379)
  Unify repo names in system notices (go-gitea#36491)
  Allow scroll propagation outside code editor (go-gitea#36502)
  Refactor ActionsTaskID (go-gitea#36503)
  Update JS deps, remove `knip`, misc tweaks (go-gitea#36499)
  [skip ci] Updated translations via Crowdin
  Fix editorconfig not respected in PR Conversation view (go-gitea#36492)
  Add FOLDER_ICON_THEME configuration option (go-gitea#36496)
  Don't create self-references in merged PRs (go-gitea#36490)
  Use reserved .test TLD for unit tests (go-gitea#36498)
  Fix bug when list pull request commits (go-gitea#36485)
  Update some go dependencies (go-gitea#36489)
  chore: add comments for "api/healthz", clean up test env (go-gitea#36481)
  [SECURITY] Toolchain Update to Go 1.25.6 (go-gitea#36480)
  [skip ci] Updated translations via Crowdin
  Render merged pull request title as such in dashboard feed (go-gitea#36479)
  ...
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 4, 2026
* origin/main: (1246 commits)
  fix(packages/container): data race when uploading container blobs concurrently (go-gitea#36524)
  [skip ci] Updated translations via Crowdin
  Remove and forbid `@ts-expect-error` (go-gitea#36513)
  Add resolve/unresolve review comment API endpoints (go-gitea#36441)
  Fix incorrect vendored detections (go-gitea#36508)
  Bump alpine to 3.23, add platforms to `docker-dryrun` (go-gitea#36379)
  Unify repo names in system notices (go-gitea#36491)
  Allow scroll propagation outside code editor (go-gitea#36502)
  Refactor ActionsTaskID (go-gitea#36503)
  Update JS deps, remove `knip`, misc tweaks (go-gitea#36499)
  [skip ci] Updated translations via Crowdin
  Fix editorconfig not respected in PR Conversation view (go-gitea#36492)
  Add FOLDER_ICON_THEME configuration option (go-gitea#36496)
  Don't create self-references in merged PRs (go-gitea#36490)
  Use reserved .test TLD for unit tests (go-gitea#36498)
  Fix bug when list pull request commits (go-gitea#36485)
  Update some go dependencies (go-gitea#36489)
  chore: add comments for "api/healthz", clean up test env (go-gitea#36481)
  [SECURITY] Toolchain Update to Go 1.25.6 (go-gitea#36480)
  [skip ci] Updated translations via Crowdin
  ...

# Conflicts:
#	modules/templates/helper.go
#	options/locale/locale_en-US.ini
#	routers/web/repo/cherry_pick.go
#	routers/web/repo/editor.go
#	routers/web/repo/patch.go
#	templates/repo/editor/edit.tmpl
#	web_src/js/features/codeeditor.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend topic/code-linting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants