forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Merge PR DefinitelyTyped#71067 Added types for react-add-new packag…
…e by @antoniom
- Loading branch information
Showing
5 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* | ||
!**/*.d.ts | ||
!**/*.d.cts | ||
!**/*.d.mts | ||
!**/*.d.*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", "./"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |