{"record":{"id":"fad6692d3088732d","repo":"biomejs/biome","slug":"must-be-a-method","errorCode":null,"errorMessage":"{} must be a method","messagePattern":"(.+?) must be a method","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":1042,"sourceCode":"        return Ok(None);\n    };\n    let name = name.name()?;\n    Ok(PROMISE_METHOD_SPECIFICATIONS\n        .iter()\n        .copied()\n        .enumerate()\n        .find(|(_, specification)| {\n            specification.location == location && specification.source_name == name.text()\n        }))\n}\n\n/// Rejects properties and accessors only when their names belong to the selected projection.\nfn reject_selected_promise_non_method(\n    name: AnyJsObjectMemberName,\n    location: PromiseMemberLocation,\n) -> Result<()> {\n    if let Some((_, specification)) = selected_promise_method(name, location)? {\n        bail!(\"{} must be a method\", specification.global_name);\n    }\n    Ok(())\n}\n\n/// Requires the global value declaration to retain its constructor interface.\nfn validate_promise_constructor_reference(\n    records: &[DeclarationRecord],\n    source_cache: &mut ParsedSourceCache,\n) -> Result<()> {\n    let mut saw_value = false;\n    for record in records {\n        let DeclarationKind::VariableDeclarator { .. } = &record.kind else {\n            continue;\n        };\n        let declarator = source_cache\n            .find_variable_declarator(record)?\n            .with_context(|| {\n                format!(","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L1024-L1060","documentation":"reject_selected_promise_non_method aborts when a property or accessor in a Promise declaration has the same name as one of the required PROMISE_METHOD_SPECIFICATIONS entries at the same member location (instance or static). Required methods must be declared as methods, not as arrow-function-typed properties or get accessors, so the strict shape check fails.","triggerScenarios":"Running generate_global_types when lib sources declare e.g. `then: (onfulfilled: ...) => ...` (property with function type), `get then() {...}`, or a static property named resolve/all instead of a method signature.","commonSituations":"Lib snapshots rewritten to property-style declarations; codemods converting method signatures to function-typed properties; vendor type definitions using accessor style.","solutions":["Convert the property or accessor into a method signature in the lib sources (e.g. `then<R1, R2>(...): Promise<...>;`)","Rename the conflicting member if it is not meant to satisfy the specification","Allow property-style methods in lower.rs if the new shape is intentional"],"exampleFix":"// before\ninterface Promise<T> { then: <R1, R2>(...: ...) => Promise<R1 | R2>; }\n// after\ninterface Promise<T> { then<R1, R2>(onfulfilled: ..., onrejected: ...): Promise<R1 | R2>; }","handlingStrategy":"validation","validationCode":"for (const m of promiseDecl.members) {\n  if (REQUIRED_METHODS.includes(m.name) && (m.type === \"Property\" || m.type === \"Accessor\")) {\n    throw new Error(`'${m.name}' must be a method signature, not a property/accessor`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare required Promise members as method signatures","Do not codemod method signatures into function-typed properties for Promise globals","Validate member shapes (method vs property) before running codegen"],"tags":["codegen","build-time","member-shape"],"backgroundTag":"schema-validation-failed","analyzedSha":"3835945f0638c88162351318b7bc8b64c5f2fba7","analyzedAt":"2026-09-13T15:11:16.919Z","contentChangedAt":"2026-09-13T15:11:16.919Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}