{"record":{"id":"824b8f2453337e6a","repo":"angular/angular","slug":"value-has-wrong-type-824b8f","errorCode":"VALUE_HAS_WRONG_TYPE","errorMessage":"No locator specified.","messagePattern":"No locator specified\\.","errorType":"exception","errorClass":"FatalDiagnosticError","httpStatus":null,"severity":"error","filePath":"packages/compiler-cli/src/ngtsc/annotations/directive/src/query_functions.ts","lineNumber":95,"sourceCode":"  }\n\n  const query = tryParseInitializerApi(\n    QUERY_INITIALIZER_FNS,\n    member.value,\n    reflector,\n    importTracker,\n  );\n  if (query === null) {\n    return null;\n  }\n\n  validateAccessOfInitializerApiMember(query, member);\n\n  const {functionName} = query.api;\n  const isSingleQuery = functionName === 'viewChild' || functionName === 'contentChild';\n  const predicateNode = query.call.arguments[0] as ts.Expression | undefined;\n  if (predicateNode === undefined) {\n    throw new FatalDiagnosticError(\n      ErrorCode.VALUE_HAS_WRONG_TYPE,\n      query.call,\n      'No locator specified.',\n    );\n  }\n\n  const optionsNode = query.call.arguments[1] as ts.Expression | undefined;\n  if (optionsNode !== undefined && !ts.isObjectLiteralExpression(optionsNode)) {\n    throw new FatalDiagnosticError(\n      ErrorCode.VALUE_HAS_WRONG_TYPE,\n      optionsNode,\n      'Argument needs to be an object literal.',\n    );\n  }\n  const options = optionsNode && reflectObjectLiteral(optionsNode);\n  const read = options?.has('read') ? parseReadOption(options.get('read')!) : null;\n  const descendants = options?.has('descendants')\n    ? parseDescendantsOption(options.get('descendants')!)","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/angular/angular/blob/51cb07e98081ab7e4e84a9e0949266a8e19cca84/packages/compiler-cli/src/ngtsc/annotations/directive/src/query_functions.ts#L77-L113","documentation":"All four signal query functions need a locator argument (string template reference or component/directive class) that becomes the query predicate. tryParseSignalQueryFromInitializer reads query.call.arguments[0]; when it is undefined, VALUE_HAS_WRONG_TYPE is thrown on the call node with 'No locator specified.'.","triggerScenarios":"panel = viewChild(); items = viewChildren(); tab = contentChild(); tabs = contentChildren(); - any zero-argument call of these initializer functions.","commonSituations":"Refactoring from constructor queries and dropping the argument mid-edit; relying on TypeScript's 'expected 1 argument' error being suppressed (JS files, satisfy hacks, generated code); IDE stub completions that insert empty calls.","solutions":["Pass a locator: viewChild('panel') for a template reference, or viewChild(PanelComponent) for a component/directive class","For token-based locators use the read option on a class locator rather than omitting the argument"],"exampleFix":"// before\nexport class Accordion {\n  header = viewChild();\n}\n\n// after\nexport class Accordion {\n  header = viewChild('header');  // or viewChild(PanelHeader) for a class locator\n}","handlingStrategy":"validation","validationCode":"const noLocator = /\\w+\\s*=\\s*(viewChild|contentChild|viewChildren|contentChildren)\\s*\\(\\s*\\)/;\nif (noLocator.test(src)) fail('signal query called without a locator argument');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a template-ref string or a component/directive class to query functions","Keep TypeScript strict argument checks enabled so empty calls fail in the editor first"],"tags":["angular","ngtsc","signals","queries","view-child","compile-time"],"backgroundTag":"missing-required-argument","analyzedSha":"51cb07e98081ab7e4e84a9e0949266a8e19cca84","analyzedAt":"2026-08-22T07:04:54.531Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}