Skip to content

Commit d36c69c

Browse files
Fix components package tsconfig (#44177)
* Fix tsconfig to include all the TS files for typechecking. * Create a dedicated file for build * Fix TS errors in the files which are now type checked * Exclude stories from build * Use the explicit inclusion for build
1 parent ecba3ca commit d36c69c

File tree

10 files changed

+16
-8
lines changed

10 files changed

+16
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
TypeScript: Fix config to include all the TS files for type checking.

projects/js-packages/components/components/jetpack-footer/test/component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { jest } from '@jest/globals';
22
import { render, screen } from '@testing-library/react';
3-
import userEvent from '@testing-library/user-event';
3+
import { userEvent } from '@testing-library/user-event';
44
import JetpackFooter from '../index.tsx';
55

66
describe( 'JetpackFooter', () => {

projects/js-packages/components/components/pricing-card/test/component.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/* eslint-disable testing-library/no-manual-cleanup */
55

66
import { jest } from '@jest/globals';
7+
// @ts-expect-error /pure subpath apparently exists
78
import { render, screen, cleanup } from '@testing-library/react/pure';
89
import PricingCard from '../index.tsx';
910

projects/js-packages/components/components/radio-control/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import clsx from 'clsx';
33
import styles from './styles.module.scss';
44
import type { FC, ReactNode } from 'react';
55

6-
interface RadioControlProps {
6+
export interface RadioControlProps {
77
/** The current value. */
88
selected: string;
99

projects/js-packages/components/components/status/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Text from '../text/index.tsx';
44
import styles from './style.module.scss';
55
import type { JSX } from 'react';
66

7-
interface StatusProps {
7+
export interface StatusProps {
88
status?: 'active' | 'error' | 'inactive' | 'action' | 'initializing';
99
label?: string;
1010
className?: string;

projects/js-packages/components/components/testimonials/test/component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render, screen } from '@testing-library/react';
2-
import userEvent from '@testing-library/user-event';
2+
import { userEvent } from '@testing-library/user-event';
33
import Testimonials from '../index.tsx';
44
import { Testimonial } from '../testimonial.tsx';
55

projects/js-packages/components/components/toggle-control/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useCallback } from 'react';
44
import styles from './styles.module.scss';
55
import type { FC, ReactNode } from 'react';
66

7-
interface ToggleControlProps {
7+
export interface ToggleControlProps {
88
/** Whether or not the toggle is currently enabled. */
99
checked?: boolean;
1010

projects/js-packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"scripts": {
9191
"build": "pnpm run clean && pnpm run compile-ts",
9292
"clean": "rm -rf build/",
93-
"compile-ts": "tsc --pretty",
93+
"compile-ts": "tsc --pretty --project tsconfig.build.json",
9494
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
9595
"test-coverage": "pnpm run test --coverage",
9696
"typecheck": "tsc --noEmit"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": [ "./index.ts", "./tools/jp-redirect/index.ts" ]
4+
}

projects/js-packages/components/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"extends": "jetpack-js-tools/tsconfig.tsc.json",
3-
"include": [ "./index.ts", "./tools/jp-redirect/index.ts" ],
3+
"include": [ "./index.ts", "./components", "./lib", "./tools" ],
44
"compilerOptions": {
5-
"typeRoots": [ "./node_modules/@types/" ],
65
"sourceMap": false,
76
"outDir": "./build/",
87
"target": "es2022",

0 commit comments

Comments
 (0)