Skip to content

Commit

Permalink
Experiment 2
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdavid committed Nov 13, 2023
1 parent b05b4e1 commit c0d20e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ts/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export type ProjectData = {
defaultExecutable?: Executable;
};

export type Plugin<Additions> = (
project: Project
export type Plugin<Dependencies, Additions> = (
project: Dependencies
) => Additions;

type ProjectHelpers = {
Expand Down Expand Up @@ -84,7 +84,7 @@ type ProjectHelpers = {
*/
add<T extends Project, Additions>(
this: T,
fn: Plugin<Additions>,
fn: T extends infer Dependencies ? Plugin<Dependencies, Additions> : never,
): Omit<T, keyof Additions> & Additions;

/**
Expand Down Expand Up @@ -221,7 +221,7 @@ const proxyEnvironmentHelpers = (): ProjectHelpers => ({

add<T extends Project, Additions>(
this: T,
fn: Plugin<Additions>
fn: T extends infer Dependencies ? Plugin<Dependencies, Additions> : never,
): Omit<T, keyof Additions> & Additions {
return {
...this,
Expand Down

0 comments on commit c0d20e0

Please sign in to comment.