Compare commits
21 Commits
main
...
ts-macros-
Author | SHA1 | Date | |
---|---|---|---|
6f44567306 | |||
d8199341e0 | |||
ebe7cf831e | |||
49b1332917 | |||
457b9cdc91 | |||
20236355c1 | |||
632c82966b | |||
2f7677c371 | |||
1ca0ac42d0 | |||
fd4ecd70ba | |||
0ebaaf35ee | |||
20078d2c87 | |||
ce974e2a99 | |||
4947a80cb4 | |||
0e2a1e830a | |||
dc6cf5165d | |||
ae2303af7c | |||
9eff2bc265 | |||
af02f1cb29 | |||
da5b2c3467 | |||
770c302342 |
@ -1,4 +1,4 @@
|
||||
export type FunctionDef = {
|
||||
export type FunctionDef {
|
||||
name: string,
|
||||
aliasOf?: string,
|
||||
signatures: Array<{
|
||||
@ -11,7 +11,6 @@ export type FunctionDef = {
|
||||
export type ImplementationDef = {
|
||||
fn: FunctionDef,
|
||||
dependencies: Record<string, FunctionDef>
|
||||
genericParameter: string | null
|
||||
}
|
||||
|
||||
/**
|
||||
@ -24,11 +23,6 @@ export function parseReflectedType(name: string, reflectedType: string): Impleme
|
||||
const [factoryArgs, fnsClause] = split(reflectedType, '=>', 2).map(trim)
|
||||
const fn = parseAlias(name, fnsClause)
|
||||
|
||||
// extract the generic parameter like '<T>' at the start of the type
|
||||
const genericParameter = factoryArgs.trim().startsWith('<')
|
||||
? findBlockContents(factoryArgs, '<', '>')?.innerText || null
|
||||
: null
|
||||
|
||||
const factoryArgsInner = findBlockContents(factoryArgs, '(', ')')
|
||||
const depArg = split(factoryArgsInner.innerText, ':').map(trim)[1]
|
||||
const depArgBlocks: string[] = depArg ? split(depArg, '&').map(trim) : []
|
||||
@ -45,7 +39,7 @@ export function parseReflectedType(name: string, reflectedType: string): Impleme
|
||||
|
||||
const dependencies: Record<string, FunctionDef> = groupBy(deps, 'name')
|
||||
|
||||
return {fn, dependencies, genericParameter }
|
||||
return {fn, dependencies}
|
||||
}
|
||||
|
||||
function parseDependencies(deps: string): FunctionDef[] {
|
||||
|
Loading…
Reference in New Issue
Block a user