Skip to content

fix: declare plain CSS and CSS module imports in types.d.ts - #26971

Merged
mshabarov merged 3 commits into
mainfrom
fix/types-d-ts-css-imports
Nov 12, 2026
Merged

mshabarov merged 3 commits into
mainfrom
fix/types-d-ts-css-imports

Conversation

@totally-not-ai

Copy link
Copy Markdown
Contributor

Fixes #26970

behavior deviation · flow-build-tools · TypeScript 6 projects that import .css or .module.css files from views

TypeScript 6 checks side-effect imports by default, so import './view.css' and import styles from './view.module.css' failed the type check (TS2882, TS2307) and showed up in the dev-mode error overlay. The generated types.d.ts now declares plain CSS imports and CSS modules, as a plain Vite project's types do.

Risks:

  • ⚠️ Behaviour change: a types.d.ts that still has the previously generated content is rewritten to the new default on the next build. Customized files are not rewritten; instead a one-time info log lists the declarations to add.
  • ✅ No API change, no security, memory, serialization, threading or performance impact.

Context. Flow checks an existing types.d.ts for the declarations it requires and appends or rejects otherwise. The new declarations are optional, so they are not added to that required set: appending them to a customized file could clash with the user's own *.css declarations.

  • Added declare module '*.module.css' (default export of class names) and declare module '*.css' {} to the types.d.ts template; *.module.css comes first because TypeScript uses the first matching pattern.
  • Kept the previous template as types.d.ts.v3; a file matching it is replaced with the new default, and it defines the declarations a customized file must contain.
  • Customized files that don't declare *.css get a one-time info log with the declarations to add.

TypeScript 6 checks side-effect imports by default, so importing a
stylesheet or a CSS module from a view failed the type check. Projects
whose types.d.ts still has the previous generated content are updated;
customized files are left without the new declarations.

Fixes #26970
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 1 691 files  ±0   1 781 suites  ±0   2h 14m 49s ⏱️ - 7m 14s
13 481 tests ±0  13 409 ✅ ±0  72 💤 ±0  0 ❌ ±0 
14 115 runs  ±0  14 043 ✅ ±0  72 💤 ±0  0 ❌ ±0 

Results for commit 6574949. ± Comparison against base commit 14e3e37.

♻️ This comment has been updated with latest results.

@mshabarov
mshabarov marked this pull request as ready for review November 12, 2026 08:35

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

✅ Nothing to flag — the changes look good.

@mshabarov mshabarov added the Intent Approved Labeled open PR means 1. Problem confirmed, 2. Solution confirmed. label Nov 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

@mshabarov
mshabarov added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit ade9074 Nov 12, 2026
62 checks passed
@mshabarov
mshabarov deleted the fix/types-d-ts-css-imports branch November 12, 2026 13:43
@github-actions

Copy link
Copy Markdown
Contributor

Pull request created: #6649

Generated by Documentation Bot · agent · 59.7 AIC · ⊞ 11.7K

@github-actions

Copy link
Copy Markdown
Contributor

Documentation Bot: Draft documentation pull request for this change: vaadin/docsvaadin/docs#6649

Files updated:

  • articles/styling/stylesheets.adoc

It was written from the state of this pull request as you see it now. Please review it and mark it ready for review.

Generated by Documentation Bot for #26971 · agent · 59.7 AIC · ⊞ 11.7K · ◷

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.4.0-alpha7.

mshabarov pushed a commit to OriginalFelix/flow that referenced this pull request Dec 1, 2026
**behavior deviation** · CI (Diagram Bot) · pull requests that get
labels while or after the bot runs

**Background — concurrency groups.** GitHub Actions lets one run per
concurrency group be in progress; with `cancel-in-progress`, a new run
in the group cancels the one in progress, and a newer pending run
replaces an older pending one.

Every label change on a pull request starts a Diagram Bot run, which
skips its jobs unless the label is `diagram`. All these runs shared one
group per pull request, so adding any other label while the bot was
working cancelled the diagram it was drawing, and labels added together
cancelled each other, which shows cancelled `safe_outputs` and
`conclusion` jobs on the pull request. Now only `diagram` runs share a
group.

**Risks:**
- ✅ No product code, public API, security, memory, serialization,
threading, performance or migration impact. Adding `diagram` again still
replaces a run in progress.

**Context.** Seen on vaadin#26971, where adding `Intent Approved` two minutes
after the bot started cancelled its agent job, and on vaadin#27449, where
adding two `target/*` labels at once left cancelled jobs on the pull
request.

- The concurrency group of `diagram-bot` now ends in `diagram` for a
`diagram` label and in the run id for any other label, so other label
changes never share a group with a diagram run or with each other.
- Recompiled `diagram-bot.lock.yml` with gh-aw v0.86.2, the version it
was compiled with; only the group line changes.
peholmst pushed a commit to vaadin/docs that referenced this pull request Dec 2, 2026
Documentation for vaadin/flow#26971 by `@totally-not-ai`[bot].

> [!NOTE]
> The source pull request is merged, so this documentation describes the
final
> shape of the change. Please review it and mark it ready for review.

**Change categories:** BEHAVIOR_CHANGE

| File | Change |
|------|--------|
| `articles/styling/stylesheets.adoc` | Updated the CSS-module-imports
paragraph: the generated `types.d.ts` now declares plain CSS and CSS
module imports by default, so the page no longer instructs readers to
add those declarations themselves unless their `types.d.ts` is
customized. |

Auto-generated by the Documentation Bot — review before merging.

> Generated by [Documentation
Bot](https://github.com/vaadin/flow/actions/runs/43230042316) for #26971
· agent · 59.7 AIC · ⊞ 11.7K ·
[◷](https://github.com/search?q=repo%3Avaadin%2Fdocs+%22gh-aw-workflow-id%3A+doc-bot%22&type=pullrequests)
> - [x] expires <!-- gh-aw-expires: 2026-12-12T13:49:27.040Z --> on Dec
12, 2026, 1:49 PM UTC

<!-- gh-aw-agentic-workflow: Documentation Bot, engine: claude, model:
agent, id: 43230042316, workflow_id: doc-bot, run:
https://github.com/vaadin/flow/actions/runs/43230042316 -->

<!-- gh-aw-expires-type: pull-request -->

<!-- gh-aw-workflow-id: doc-bot -->
<!-- gh-aw-workflow-call-id: vaadin/flow/doc-bot -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Intent Approved Labeled open PR means 1. Problem confirmed, 2. Solution confirmed. Released with Vaadin 25.4.0-alpha7 +0.0.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSS imports in React views fail the TypeScript check, because types.d.ts doesn't declare them

3 participants