TS fixes for package resolution

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/09eeb4eb963f49eef8eb737af05bee10c5c09ab1

commit 09eeb4eb963f49eef8eb737af05bee10c5c09ab1
Author: dpapad <dpapad@chromium.org>
Date:   Wed Jan 14 13:55:11 2026 -0800

    [Reland] WebUI: Switch default tsconfig moduleResolution to 'NodeNext'.

    Reland notes:
     - Revert culprit was fixed in a separate precursor CL
       https://dawn-review.googlesource.com/c/dawn/+/284476.
     - package.json is now declared as a GN input to ensure any node() GN
       targets are marked as dirty when this file is modified.
     - A newly encountered error in ash/webui/boca_ui/resources/BUILD.gn is
       also fixed by using moduleResolution='bundler'.

    The default TS configuration at tools/typescript/tsconfig_base.json did
    not previously explicitly specify 'moduleResolution'. In TS v5 it is
    inferred as 'classic'. In the upcoming TS v6 'classic' is deprecated [1]
    and in v7 it is completely removed.

    Switching off of 'classic' is a necessary preparatory step to unblock
    further migrating to TS v6 and v7. 'NodeNext' is the most appropriate
    mode from the options being offered (essentially between 'NodeNext' and
    'Bundler', also see [2]).

    Specifically:
     - Add top-level package.json file (required for 'NodeNext' to work).
     - Explicitly specify moduleResolution where the new default 'NodeNext'
       doesn't work. Preferring 'bundler' where possible, but still using
       'classic' in cases where non-trivial work is required to migrate off
       of 'classic'.
     - Update tools/polymer/css_minifier.js to use ESM imports since it is
       now evaluated as an ES module itself.
     - Update defaults in tools/typescript/tsconfig_base.json and
       tools/typescript/tsconfig_definitions_base.json.

    [1] https://github.com/microsoft/TypeScript/issues/62206
    [2] https://github.com/microsoft/TypeScript/issues/62905

    Bug: 423789047
    Change-Id: I8f516a44e29a1aa2c3c403c1e6b59b8dcf421ebb
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7465877
    Reviewed-by: Nico Weber <thakis@chromium.org>
    Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
    Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
    Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1569313}
This commit is contained in:
Claudio DeSouza
2026-02-26 13:47:44 +00:00
parent ce5f61d5c9
commit 4963c129cc
7 changed files with 38 additions and 42 deletions
@@ -12,7 +12,7 @@ import {
} from '../page_visibility.js'
// Merge our interface additions with upstream's interface
declare module '../page_visibility' {
declare module '../page_visibility.js' {
export interface PageVisibility {
braveSync?: boolean
braveWallet?: boolean
@@ -5,7 +5,7 @@
import { html } from '//resources/lit/v3_0/lit.rollup.js'
import { SettingsBraveContentContainersBackgroundChipElement } from './containers_background_chip'
import {SettingsBraveContentContainersBackgroundChipElement} from './containers_background_chip.js'
export function getHtml(
this: SettingsBraveContentContainersBackgroundChipElement,
@@ -5,7 +5,7 @@
import { html } from '//resources/lit/v3_0/lit.rollup.js'
import { SettingsBraveContentContainersIconElement } from './containers_icon'
import {SettingsBraveContentContainersIconElement} from './containers_icon.js'
export function getHtml(this: SettingsBraveContentContainersIconElement) {
return html`
@@ -5,7 +5,7 @@
import { CustomizeChromeApiProxy } from './customize_chrome_api_proxy.js'
import { CrLitElement, html, css } from '//resources/lit/v3_0/lit.rollup.js'
import { CrLitElement, html, css, type CSSResultGroup } from '//resources/lit/v3_0/lit.rollup.js'
import { loadTimeData } from '//resources/js/load_time_data.js'
import { I18nMixinLit } from '//resources/cr_elements/i18n_mixin_lit.js'
import { CustomizeColorSchemeModeBrowserProxy } from '//resources/cr_components/customize_color_scheme_mode/browser_proxy.js'
@@ -56,7 +56,7 @@ class DarkerThemeToggle extends I18nMixinLit(CrLitElement) {
private accessor usingDarkerTheme_ = false
static override get styles() {
static override get styles(): CSSResultGroup {
return css`
#darker-theme-toggle-container {
display: flex;
@@ -70,7 +70,7 @@ class DarkerThemeToggle extends I18nMixinLit(CrLitElement) {
}
/* Hide the darker theme toggle container if the color scheme is light.
This is to avoid showing the toggle button when user is using System
This is to avoid showing the toggle button when user is using System
color scheme mode and the system is using light color scheme. */
@media (prefers-color-scheme: light) {
#darker-theme-toggle-container {
@@ -5,40 +5,39 @@
import '//resources/brave/leo.bundle.js';
import { getHtml } from './cr_button.html.js';
import { CrLitElement, css, type PropertyValues } from '//resources/lit/v3_0/lit.rollup.js';
import {CrLitElement, css, type CSSResultGroup, type PropertyValues} from '//resources/lit/v3_0/lit.rollup.js';
export interface CrButtonElement {
$: {
button: HTMLElement
prefixIcon: HTMLSlotElement
suffixIcon: HTMLSlotElement
};
}
import {getHtml} from './cr_button.html.js';
export class CrButtonElement extends CrLitElement {
static get is() {
return 'cr-button';
}
static override get styles() {
declare $: {
button: HTMLElement
prefixIcon: HTMLSlotElement
suffixIcon: HTMLSlotElement
}
static override get styles(): CSSResultGroup {
return css`
:host {
display: inline-block;
height: min-content;
}
:host {
display: inline-block;
height: min-content;
}
:host(.cancel-button) {
margin-inline-end: var(--leo-spacing-m);
}
:host(.cancel-button) {
margin-inline-end: var(--leo-spacing-m);
}
leo-button {
display: flex;
width: 100%;
height: 100%;
align-items: center;
}
`;
leo-button {
display: flex;
width: 100%;
height: 100%;
align-items: center;
}
`;
}
override render() {
@@ -5,27 +5,24 @@
import '//resources/brave/leo.bundle.js'
import { CrLitElement, css } from '//resources/lit/v3_0/lit.rollup.js';
import { getHtml } from './cr_toggle.html.js';
import {CrLitElement, css, type CSSResultGroup} from '//resources/lit/v3_0/lit.rollup.js';
import {getHtml} from './cr_toggle.html.js';
export const MOVE_THRESHOLD_PX: number = 5;
export interface CrToggleElement {
$: {
toggle: HTMLElement
knob: HTMLElement
}
}
export class CrToggleElement extends CrLitElement {
static get is() {
return 'cr-toggle';
}
static override get styles() {
return css``
declare $: {
toggle: HTMLElement
knob: HTMLElement
}
static override get styles(): CSSResultGroup{ return css`` }
override render() {
return getHtml.bind(this)();
}
@@ -56,4 +56,4 @@ cr-icon-button {
:host(:hover:not([search-focused_], [narrow])) #stateBackground {
background: rgba(0, 0, 0, 0.05);
}
}