diff --git a/src/generic/arithmetic.ts b/src/generic/arithmetic.ts index 78ad57d..cbb1062 100644 --- a/src/generic/arithmetic.ts +++ b/src/generic/arithmetic.ts @@ -1,5 +1,22 @@ -import type {Dependencies, Signature} from '../interfaces/type.js' +import {ReflectionFunction, stringifyType, typeOf} from '@deepkit/type' +import type {Dependencies, Signature, Signatures, OneType} from '../interfaces/type.js' + +interface LocalSignatures { + one: (a: T) => OneType +} export const square = (dep: Dependencies<'multiply', T>): Signature<'square', T> => z => dep.multiply(z, z) + +const sqRefl = ReflectionFunction.from(square) +console.log( + ' For generic square I know that:', + sqRefl, + sqRefl.getParameterNames(), + sqRefl.getParameterType('dep'), + "\n final dep type:", + stringifyType(sqRefl.getParameterType('dep'))) + +console.log(' because', typeOf['one']>()) +console.log(' readable:', stringifyType(typeOf['one']>())) diff --git a/src/local.ts b/src/local.ts new file mode 100644 index 0000000..98de68d --- /dev/null +++ b/src/local.ts @@ -0,0 +1,10 @@ +import type {ImportedInterface} from './remote.js' + +interface LocalInterface { + item: (a: number) => string +} + +import {stringifyType, typeOf} from '@deepkit/type' + +console.log('Locally:', stringifyType(typeOf())) +console.log('Remotely:', stringifyType(typeOf())) diff --git a/src/remote.ts b/src/remote.ts new file mode 100644 index 0000000..51df8d3 --- /dev/null +++ b/src/remote.ts @@ -0,0 +1,3 @@ +export interface ImportedInterface { + item: (a: number) => string +}