Skip to content

valid: (value: string) => void but {valid(value) {} } error "Parameter 'value' implicitly has an 'any' type." #60058

Closed as not planned

Description

@yamiwamiyu

🔎 Search Terms

function inference any

🕗 Version & Regression Information

  • This changed between versions ______ and _______
  • This changed in commit or PR _______
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
  • I was unable to test this on prior versions because _______

⏯ Playground Link

https://www.typescriptlang.org/play/?noUncheckedIndexedAccess=true&useDefineForClassFields=true&allowUnreachableCode=true&allowUnusedLabels=true&downlevelIteration=true&noEmitHelpers=true&noStrictGenericChecks=true&noUnusedLocals=true&noUnusedParameters=true&preserveConstEnums=true&removeComments=true&importHelpers=true&experimentalDecorators=true&emitDecoratorMetadata=true&isolatedModules=true&isolatedDeclarations=false&allowUmdGlobalAccess=true&exactOptionalPropertyTypes=true&noFallthroughCasesInSwitch=true&noImplicitOverride=true&noPropertyAccessFromIndexSignature=true&useUnknownInCatchVariables=true&strictBuiltinIteratorReturn=true&noImplicitUseStrict=true&suppressImplicitAnyIndexErrors=true&preserveValueImports=true&keyofStringsOnly=true&suppressExcessPropertyErrors=true&noCheck=false&noErrorTruncation=true&preserveWatchOutput=true&verbatimModuleSyntax=true&allowSyntheticDefaultImports=true&allowArbitraryExtensions=true&noUncheckedSideEffectImports=true&resolvePackageJsonImports=true&resolvePackageJsonExports=true&allowImportingTsExtensions=true&disableSourceOfProjectReferenceRedirect=true&inlineSourceMap=true&inlineSources=true&stripInternal=true&pretty=true&ts=5.6.0-dev.20240818&ssl=140&ssc=43&pln=140&pc=61&noLib=true&filetype=ts#

💻 Code

// detail please see Playground Link
g<{
    ID?: number;
    Name?: string;
    Face?: string;
    Time?: Date;
}>().build({
    ID: {default: 10, },
    other: {init: '', default: 0, rules: [{valid(value) {} }]},
})

🙁 Actual behavior

Mouse over the valid to display valid: (value: string) => void
Mouse over the value to display Parameter 'value' implicitly has an 'any' type.

🙂 Expected behavior

value type is string not any

Additional information about the issue

No response

Activity

  1. MartinJohns commented on Sep 25, 2024

    @MartinJohns
    Contributor

    Duplicate of #47599.

  2. typescript-bot commented on Sep 28, 2024

    @typescript-bot
    Contributor

    This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

  3. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions