Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#71067 Added types for react-add-new packag…
Browse files Browse the repository at this point in the history
…e by @antoniom
  • Loading branch information
antoniom authored Nov 5, 2024
1 parent df4e58e commit 09d823e
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
5 changes: 5 additions & 0 deletions types/react-add-new/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
15 changes: 15 additions & 0 deletions types/react-add-new/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface CreateStatus {
status: "OK" | "ERR";
msg: string;
}

export function createContext(componentName: string, contextPath: string): Promise<CreateStatus>;

export function createComponent(
componentName: string,
componentPath: string,
noStyles: boolean,
noTypes: boolean,
): Promise<CreateStatus>;

export function validateName(name: string): true | string;
17 changes: 17 additions & 0 deletions types/react-add-new/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"name": "@types/react-add-new",
"version": "1.2.9999",
"projects": [
"https://github.com/grigorischristainas/react-add-new"
],
"devDependencies": {
"@types/react-add-new": "workspace:."
},
"owners": [
{
"name": "Antonis Balasas",
"githubUsername": "antoniom"
}
]
}
10 changes: 10 additions & 0 deletions types/react-add-new/react-add-new-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createComponent, createContext, validateName } from "react-add-new";

// $ExpectType true | string
const result = validateName("foo");

// $ExpectType Promise<CreateStatus>
createComponent("Foo", "./", true, true);

// $ExpectType Promise<CreateStatus>
createContext("Foo", "./");
14 changes: 14 additions & 0 deletions types/react-add-new/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"module": "node16",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "react-add-new-tests.ts"]
}

0 comments on commit 09d823e

Please sign in to comment.