-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(type): make sure forwarded type arguments reset Ω at the origin
closes #619
- Loading branch information
Showing
4 changed files
with
49 additions
and
23 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
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
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
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,28 @@ | ||
import { expect, test } from '@jest/globals'; | ||
import { ReceiveType, resolveReceiveType } from '../../src/reflection/reflection'; | ||
import { Type } from '../../src/reflection/type'; | ||
import { forwardTypeArguments } from '@deepkit/core'; | ||
|
||
test('function default', () => { | ||
class Clazz { | ||
create<T>(sql: string, type?: ReceiveType<T>): Type { | ||
return resolveReceiveType(type); | ||
} | ||
} | ||
|
||
class Fascade { | ||
create: Clazz['create']; | ||
|
||
constructor() { | ||
this.create = (...args: any) => { | ||
const clazz = new Clazz; | ||
forwardTypeArguments(this.create, clazz.create); | ||
return clazz.create.apply(clazz, args); | ||
}; | ||
} | ||
} | ||
|
||
const clazz = new Fascade(); | ||
const t1 = clazz.create<{count1: string}>(''); | ||
expect(() => clazz.create('')).toThrow('No type information received'); | ||
}); |