diff --git a/types/react-add-new/.npmignore b/types/react-add-new/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/react-add-new/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/react-add-new/index.d.ts b/types/react-add-new/index.d.ts new file mode 100644 index 00000000000000..d4c53160a61c09 --- /dev/null +++ b/types/react-add-new/index.d.ts @@ -0,0 +1,15 @@ +export interface CreateStatus { + status: "OK" | "ERR"; + msg: string; +} + +export function createContext(componentName: string, contextPath: string): Promise; + +export function createComponent( + componentName: string, + componentPath: string, + noStyles: boolean, + noTypes: boolean, +): Promise; + +export function validateName(name: string): true | string; diff --git a/types/react-add-new/package.json b/types/react-add-new/package.json new file mode 100644 index 00000000000000..d04e3b6f85cea0 --- /dev/null +++ b/types/react-add-new/package.json @@ -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" + } + ] +} diff --git a/types/react-add-new/react-add-new-tests.ts b/types/react-add-new/react-add-new-tests.ts new file mode 100644 index 00000000000000..a204eb9e60c3f4 --- /dev/null +++ b/types/react-add-new/react-add-new-tests.ts @@ -0,0 +1,10 @@ +import { createComponent, createContext, validateName } from "react-add-new"; + +// $ExpectType true | string +const result = validateName("foo"); + +// $ExpectType Promise +createComponent("Foo", "./", true, true); + +// $ExpectType Promise +createContext("Foo", "./"); diff --git a/types/react-add-new/tsconfig.json b/types/react-add-new/tsconfig.json new file mode 100644 index 00000000000000..6b6e07ba57fcbc --- /dev/null +++ b/types/react-add-new/tsconfig.json @@ -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"] +}