{"version":3,"file":"get-injectable-token.mjs","names":["DIError","InjectableTokenMeta","getInjectableToken","target","token","classNotInjectable","name"],"sources":["../../../src/utils/get-injectable-token.mts"],"sourcesContent":["import type { ClassType, InjectionToken } from '../token/injection-token.mjs'\n\nimport { DIError } from '../errors/di-error.mjs'\nimport { InjectableTokenMeta } from '../symbols/index.mjs'\n\nexport function getInjectableToken<R>(\n  target: ClassType,\n): R extends { create(...args: any[]): infer V }\n  ? InjectionToken<V>\n  : InjectionToken<R> {\n  // @ts-expect-error We inject the token into the class itself\n  const token = target[InjectableTokenMeta] as InjectionToken<any, any>\n  if (!token) {\n    throw DIError.classNotInjectable(target.name)\n  }\n  // @ts-expect-error We detect factory or class\n  return token\n}\n"],"mappings":";;;;AAKA,SAAgBE,mBACdC,QAAiB;CAKjB,MAAMC,QAAQD,OAAOF;AACrB,KAAI,CAACG,MACH,OAAMJ,QAAQK,mBAAmBF,OAAOG,KAAI;AAG9C,QAAOF"}