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

Update dependency prettier-plugin-organize-imports to v4 #109

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ You can even try it out live right now:

This embedded example doesn't have great [TypeScript] support.

<Link to={GETTING_STARTED_URL}>Open the full sandbox</Link> for a better preview.
<Link to={GETTING_STARTED_URL}>Open the full sandbox</Link> for a better
preview.

[typescript]: https://www.typescriptlang.org/

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@snout/jest-config": "^4.0.0",
"@snout/tsconfig": "^3.0.0",
"prettier": "^3.0.0",
"prettier-plugin-organize-imports": "^3.0.0",
"prettier-plugin-organize-imports": "^4.0.0",
"size-limit": "^11.0.0",
"typescript": "^5.1.6"
}
Expand Down
27 changes: 9 additions & 18 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,11 @@ export interface Param<Name extends string, Arg = string> {
readonly format: (arg: Arg) => string;
}

export type ParamArg<Subject extends AnyParam> = Subject extends Param<
string,
infer Arg
>
? Arg
: never;

export type ParamName<Subject extends AnyParam> = Subject extends Param<
infer Name,
any
>
? Name
: never;
export type ParamArg<Subject extends AnyParam> =
Subject extends Param<string, infer Arg> ? Arg : never;

export type ParamName<Subject extends AnyParam> =
Subject extends Param<infer Name, any> ? Name : never;

export type ParamOrString = AnyParam | string;

Expand Down Expand Up @@ -125,11 +117,10 @@ export function path<Params extends ParamsOrStrings>(
type AnyParams = AnyParam[];
type ParamsOrStrings = ParamOrString[];

type Result<Params extends AnyParams> = Params extends Array<
Param<infer Name, any>
>
? { [Key in Name]: ParamArg<Extract<Params[number], Param<Key, any>>> }
: { [Key in string]: any };
type Result<Params extends AnyParams> =
Params extends Array<Param<infer Name, any>>
? { [Key in Name]: ParamArg<Extract<Params[number], Param<Key, any>>> }
: { [Key in string]: any };

type Args<Params extends AnyParams> = AllowOmitUndefined<Result<Params>> & {
[Key in string]: any;
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"devDependencies": {
"@snout/eslint-config-react": "^2.0.4",
"prettier": "^3.0.0",
"prettier-plugin-organize-imports": "^3.0.0"
"prettier-plugin-organize-imports": "^4.0.0"
},
"browserslist": {
"production": [
Expand Down
Loading