Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples eliminate ts warnings #600

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/jest/jest.tsx
Expand Up @@ -32,7 +32,7 @@ type State = {
};

class Jest extends React.Component<Record<string, unknown>, State> {
constructor(props) {
constructor(props: any) {
super(props);

this.state = {
Expand All @@ -42,7 +42,7 @@ class Jest extends React.Component<Record<string, unknown>, State> {
};
}

render() {
override render() {
const {startTime, completedTests, runningTests} = this.state;

return (
Expand Down Expand Up @@ -71,7 +71,7 @@ class Jest extends React.Component<Record<string, unknown>, State> {
);
}

componentDidMount() {
override componentDidMount() {
const queue = new PQueue({concurrency: 4});

for (const path of paths) {
Expand Down
4 changes: 2 additions & 2 deletions examples/static/static.tsx
Expand Up @@ -11,7 +11,7 @@ function Example() {

React.useEffect(() => {
let completedTests = 0;
let timer;
let timer: string | number | NodeJS.Timeout | undefined; //any?

const run = () => {
if (completedTests++ < 10) {
Expand All @@ -23,7 +23,7 @@ function Example() {
}
]);

timer = setTimeout(run, 100);
timer = setTimeout(run, 500);
}
};

Expand Down
4 changes: 2 additions & 2 deletions examples/subprocess-output/subprocess-output.tsx
@@ -1,5 +1,5 @@
import childProcess from 'node:child_process';
import type Buffer from 'node:buffer';
// import type Buffer from 'node:buffer';
import React from 'react';
import stripAnsi from 'strip-ansi';
import {render, Text, Box} from '../../src/index.js';
Expand All @@ -22,7 +22,7 @@ function SubprocessOutput() {

return (
<Box flexDirection="column" padding={1}>
<Text>Сommand output:</Text>
<Text>Command output:</Text>
<Box marginTop={1}>
<Text>{output}</Text>
</Box>
Expand Down
3 changes: 2 additions & 1 deletion examples/suspense/suspense.tsx
Expand Up @@ -8,7 +8,7 @@ let value: string | undefined;
const read = () => {
if (!promise) {
promise = new Promise(resolve => {
setTimeout(resolve, 500);
setTimeout(resolve, 2500);
});

state = 'pending';
Expand All @@ -27,6 +27,7 @@ const read = () => {
if (state === 'done') {
return value;
}
return undefined;
};

function Example() {
Expand Down
4 changes: 4 additions & 0 deletions examples/tsconfig.json
@@ -0,0 +1,4 @@
{
"extends": "../tsconfig",
"jsx": "react"
}
2 changes: 1 addition & 1 deletion examples/use-focus-with-id/use-focus-with-id.tsx
Expand Up @@ -41,7 +41,7 @@ function Focus() {
}

type ItemProps = {
id: number;
id?: string;
label: string;
};

Expand Down
2 changes: 1 addition & 1 deletion examples/use-focus/use-focus.tsx
Expand Up @@ -17,7 +17,7 @@ function Focus() {
);
}

function Item({label}) {
function Item({label}: {label: string}) {
const {isFocused} = useFocus();
return (
<Text>
Expand Down