Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/packages/check-build-type-declaration-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function getDecFile( packagePath ) {
async function typecheckDeclarations( file ) {
return new Promise( ( resolve, reject ) => {
exec(
`npx tsc --target esnext --moduleResolution node --noEmit --skipLibCheck "${ file }"`,
`npx tsc --ignoreConfig --target esnext --moduleResolution bundler --noEmit --skipLibCheck "${ file }"`,
( error, stdout, stderr ) => {
if ( error ) {
reject( { file, error, stderr, stdout } );
Expand Down
22 changes: 18 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"sprintf-js": "1.1.1",
"style-loader": "3.2.1",
"stylelint-plugin-logical-css": "^1.2.3",
"typescript": "5.9.3",
"typescript": "6.0.2",
"uuid": "9.0.1",
"wait-on": "8.0.1"
},
Expand Down
1 change: 1 addition & 0 deletions packages/boot/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [ "style-imports" ],
"checkJs": false
},
"references": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ underlying `grid` widget.

### `onChange`

- Type: `(newValue: AlignmentMatrixControlValue) => void`
- Type: `((newValue: AlignmentMatrixControlValue) => void)`
- Required: No

A function that receives the updated alignment value.
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ If provided, renders `a` instead of `button`.

### `icon`

- Type: `IconType`
- Type: `IconType | null`
- Required: No

If provided, renders an Icon component inside the button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import type { Modifiers, BaseProps } from '../types';

function isLocaleRTL( localeCode: string ) {
const localeObj = new Intl.Locale( localeCode );
if ( 'getTextInfo' in localeObj ) {
// @ts-expect-error - getTextInfo is not typed yet
// see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
return localeObj.getTextInfo().direction === 'rtl';
const direction = localeObj.getTextInfo?.().direction;
if ( direction ) {
return direction === 'rtl';
}
return [
'ar', // Arabic
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/form-file-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Children are passed as children of `Button`.

### `icon`

- Type: `IconType`
- Type: `IconType | null`
- Required: No

The icon to render in the default button.
Expand All @@ -65,7 +65,7 @@ Whether to allow multiple selection of files or not.

### `onChange`

- Type: `ChangeEventHandler<HTMLInputElement>`
- Type: `ChangeEventHandler<HTMLInputElement> | undefined`
- Required: Yes

Callback function passed directly to the `input` file element.
Expand Down Expand Up @@ -95,7 +95,7 @@ an empty string in the `onClick` function.

### `render`

- Type: `(arg: { openFileDialog: () => void; }) => ReactNode`
- Type: `((arg: { openFileDialog: () => void; }) => ReactNode)`
- Required: No

Optional callback function used to render the UI.
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/gradient-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ Only used when `asButtons` is not true.

### `onChange`

- Type: `(currentGradient: string) => void`
- Type: `(currentGradient: string | undefined) => void`
- Required: Yes

The function called when a new gradient has been defined. It is passed to
the `currentGradient` as an argument.

### `value`

- Type: `string`
- Type: `string | null`
- Required: No
- Default: `'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'`

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/icon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { wordpress } from '@wordpress/icons';

### `icon`

- Type: `IconType`
- Type: `IconType | null`
- Required: No
- Default: `null`

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/menu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ component, and the `Menu.Popover` component.

### `as`

- Type: `"symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | ... 516 more ... | ("view" & FunctionComponent<...>)`
- Type: `"symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "button" | "canvas" | ... 517 more ...`
- Required: No

The HTML element or React component to render the component as.
Expand Down Expand Up @@ -57,7 +57,7 @@ override the `defaultOpen` prop.

### `onOpenChange`

- Type: `(open: boolean) => void`
- Type: `((open: boolean) => void)`
- Required: No

A callback that gets called when the `open` state changes.
Expand Down
12 changes: 6 additions & 6 deletions packages/components/src/tabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It is responsible for managing the state of the tabs, and rendering one instance

### `activeTabId`

- Type: `string`
- Type: `string | null`
- Required: No

The current active tab `id`. The active tab is the tab element within the
Expand All @@ -42,7 +42,7 @@ components as there are `Tabs.Tab` components.

### `defaultTabId`

- Type: `string`
- Type: `string | null`
- Required: No

The id of the tab whose panel is currently visible.
Expand All @@ -56,7 +56,7 @@ provided (meaning the component will be used in "controlled" mode).

### `defaultActiveTabId`

- Type: `string`
- Type: `string | null`
- Required: No

The tab id that should be active by default when the composite widget is
Expand All @@ -69,14 +69,14 @@ provided.

### `onSelect`

- Type: `(selectedId: string) => void`
- Type: `((selectedId: string | null) => void)`
- Required: No

The function called when the `selectedTabId` changes.

### `onActiveTabIdChange`

- Type: `(activeId: string) => void`
- Type: `((activeId: string | null) => void)`
- Required: No

A callback that gets called when the `activeTabId` state changes.
Expand Down Expand Up @@ -107,7 +107,7 @@ for more info.

### `selectedTabId`

- Type: `string`
- Type: `string | null`
- Required: No

The id of the tab whose panel is currently visible.
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tree-select/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ If this property is added, an option will be added with this label to represent

### `onChange`

- Type: `(value: string, extra?: { event?: ChangeEvent<HTMLSelectElement>; }) => void`
- Type: `((value: string, extra?: { event?: ChangeEvent<HTMLSelectElement>; }) => void) | undefined`
- Required: No

A function that receives the value of the new option that is being selected as input.
Expand Down
4 changes: 2 additions & 2 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"types": [
"gutenberg-env",
"gutenberg-test-env",
"css-modules",
"jest"
"jest",
"style-imports"
]
},
"references": [
Expand Down
7 changes: 6 additions & 1 deletion packages/dataviews/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [ "gutenberg-env", "gutenberg-test-env", "jest" ]
"types": [
"gutenberg-env",
"gutenberg-test-env",
"jest",
"style-imports"
]
},
"references": [
{ "path": "../components" },
Expand Down
1 change: 1 addition & 0 deletions packages/editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [ "style-imports" ],
"checkJs": false
},
"references": [
Expand Down
1 change: 1 addition & 0 deletions packages/image-cropper/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [ "style-imports" ],
"checkJs": false
},
"references": [
Expand Down
1 change: 1 addition & 0 deletions packages/lazy-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [ "style-imports" ],
"checkJs": false
},
"references": [
Expand Down
2 changes: 1 addition & 1 deletion packages/notices/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": [ "gutenberg-env" ],
"types": [ "gutenberg-env", "style-imports" ],
"checkJs": false
},
"references": [
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/tsconfig.src.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "bundler",
"types": [ "css-modules" ]
"types": [ "style-imports" ]
},
"files": [ "global.d.ts" ],
"references": [ { "path": "../element" }, { "path": "../private-apis" } ]
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
/* Module Resolution Options */
"moduleResolution": "bundler",

/* This needs to be false so our types are possible to consume without setting this */
"esModuleInterop": false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We still have some esModuleInterop: true declaration in a few tsconfig.base.json. If this option is going to be completely removed in TS 7.0, we should remove them, too. So that we are prepared.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Cleaned up in #77095

"resolveJsonModule": true,

"typeRoots": [ "./typings", "./node_modules/@types" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ declare module '*.module.scss' {
const classes: { [ key: string ]: string };
export default classes;
}

declare module '*.css';
declare module '*.scss';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mirka recently opened an issue (#76744) proposing that we eliminate these non-module CSS imports from our codebase.

At this moment most these imports are in the boot package. And all of them are very recent additions.

Loading