Skip to content

Commit

Permalink
Merge pull request #4 from XenoPOMP/refactor
Browse files Browse the repository at this point in the history
Refactor file exports
  • Loading branch information
XenoPOMP authored Jan 28, 2024
2 parents 87aa4b8 + ed59d07 commit 4a7f832
Show file tree
Hide file tree
Showing 40 changed files with 60 additions and 147 deletions.
108 changes: 0 additions & 108 deletions .avt/scripts/autodoc.ts

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Build types
- name: Build legacy
run: |
yarn install --frozen-lockfile
yarn build
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xenopomp/advanced-types",
"version": "1.6.5",
"version": "1.7.0",
"description": "Library of advanced TypeScript types for React and Node projects.",
"main": "src/index.ts",
"types": "dist/index.d.ts",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/types/Primitive.ts → src/aliases/Primitive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
* Primitive types union.
* Primitive legacy union.
*/
export type Primitive = string | number | boolean;
3 changes: 3 additions & 0 deletions src/aliases/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { Primitive } from './Primitive';
export { Empty } from './Empty';
export { FunctionPrimitive } from './FunctionPrimitive';
50 changes: 18 additions & 32 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
export { ArrayType } from './types/ArrayType';
export { AsyncFC } from './types/AsyncFC';
export { AsyncReturnType } from './types/AsyncReturnType';
export { DeepInject } from './types/DeepInject';
export { Defined } from './types/Defined';
export { Empty } from './types/Empty';
export { EsmImport } from './types/EsmImport';
export { FunctionPrimitive } from './types/FunctionPrimitive';
export { FunctionType } from './types/FunctionType';
export { FunctionalChildren } from './types/FunctionalChildren';
export { Jsonish } from './types/Jsonish';
export { KeyCodes } from './types/KeyCodes';
export { MetaInfo } from './types/MetaInfo';
export { Modify } from './types/Modify';
export { Nullable } from './types/Nullable';
export { Primitive } from './types/Primitive';
export { PromiseReturnType } from './types/PromiseReturnType';
export { PropsWith } from './types/PropsWith';
export { PropsWithClassnames } from './types/PropsWithClassnames';
export { PropsWithId } from './types/PropsWithId';
export { PropsWithStyles } from './types/PropsWithStyles';
export { RecordKey } from './types/RecordKey';
export { RecordValue } from './types/RecordValue';
export { ReplaceReturnType } from './types/ReplaceReturnType';
export { SelectivePartial } from './types/SelectivePartial';
export { Undefinable } from './types/Undefinable';
export { AsyncVariableFC, VariableFC } from './types/VariableFC';
export { NextErrorParams, WithErrorParams } from './types/WithErrorParams';
export { NextParams, WithParams } from './types/WithParams';
export { WithSearchParams } from './types/WithSearchParams';
export { DeepWriteable, Writeable } from './types/Writeable';
export { MatchType } from './types/MatchType';
// Aliases
export * from './aliases';

// Utilities
export * from './utilities';

// React
export * from './react';

// Next.js
export * from './next';

// Legacy
export { PromiseReturnType } from './legacy/PromiseReturnType';
export { MetaInfo } from './legacy/MetaInfo';
export { KeyCodes } from './legacy/KeyCodes';
export { FunctionType } from './legacy/FunctionType';
export { EsmImport } from './legacy/EsmImport';
2 changes: 2 additions & 0 deletions src/types/EsmImport.ts → src/legacy/EsmImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { ComponentType } from 'react';

/**
* This type is ES Module import alias.
*
* @deprecated
*/
export type EsmImport<Import extends any = ComponentType<any>> = () => Promise<{
default: Import;
Expand Down
2 changes: 1 addition & 1 deletion src/types/FunctionType.ts → src/legacy/FunctionType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReplaceReturnType } from './ReplaceReturnType';
import { ReplaceReturnType } from '../utilities/ReplaceReturnType';

/**
* Constructs function type.
Expand Down
3 changes: 3 additions & 0 deletions src/types/KeyCodes.ts → src/legacy/KeyCodes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @deprecated
*/
export const KeyCodes = {
Backspace: 'Backspace',
Tab: 'Tab',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AsyncReturnType } from './AsyncReturnType';
import { AsyncReturnType } from '../utilities/AsyncReturnType';

/**
* Get return type of function that returns Promise ((...args: any) => Promise<any>).
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/next/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './WithParams';
export * from './WithErrorParams';
export * from './WithSearchParams';
2 changes: 1 addition & 1 deletion src/types/AsyncFC.ts → src/react/AsyncFC.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC, ReactNode } from 'react';

import { ReplaceReturnType } from './ReplaceReturnType';
import { ReplaceReturnType } from '../utilities/ReplaceReturnType';

/**
* Same as **FC** (or FunctionalComponent), but it returns Promise.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions src/react/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export * from './VariableFC';
export * from './AsyncFC';

export { PropsWith } from './PropsWith';
export { PropsWithClassnames } from './PropsWithClassnames';
export { PropsWithId } from './PropsWithId';
export { PropsWithStyles } from './PropsWithStyles';

export { FunctionalChildren } from './FunctionalChildren';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion src/types/Jsonish.ts → src/utilities/Jsonish.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { RecursiveKeyValuePair } from 'tailwindcss/types/config';

import { Primitive } from '../aliases/Primitive';

import { Nullable } from './Nullable';
import { Primitive } from './Primitive';

type JsonSchemaType = RecursiveKeyValuePair<
PropertyKey,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions src/utilities/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export { DeepWriteable, Writeable } from './Writeable';
export { MatchType } from './MatchType';
export { ArrayType } from './ArrayType';
export { AsyncReturnType } from './AsyncReturnType';
export { DeepInject } from './DeepInject';
export { Defined } from './Defined';
export { Jsonish } from './Jsonish';
export { Modify } from './Modify';
export { Nullable } from './Nullable';
export { RecordKey } from './RecordKey';
export { RecordValue } from './RecordValue';
export { ReplaceReturnType } from './ReplaceReturnType';
export { SelectivePartial } from './SelectivePartial';
export { Undefinable } from './Undefinable';

0 comments on commit 4a7f832

Please sign in to comment.