reportUnknownParameterType.md

April 8, 2026 · View on GitHub

Overview

reportUnknownParameterType is a diagnostic in Pylance and Pyright that warns when a function or method parameter has an unknown type. This helps catch missing or ambiguous type annotations, improving code clarity and type safety.

Representative Issues

  • #4382: Ensure that the correct version of static analysis tools is used and verify that all necessary dependencies, including type stubs, are correctly installed.
  • #5202: Always provide detailed type annotations in library stubs to enhance the accuracy of static analysis tools like Pylance.
  • #1117: Always include type hints for all class members to help static analysis tools like Pyright accurately infer types.
  • #1759: Ensure that libraries used in a project include type information or provide stub files to aid static analysis tools like pyright.

Examples

Error:

def process(data):  # Parameter 'data' has unknown type
    return data.strip()

Fix — add a type annotation:

def process(data: str) -> str:
    return data.strip()

For callbacks with complex signatures:

from collections.abc import Callable

def apply(func: Callable[[int], str], value: int) -> str:
    return func(value)

Common Fixes & Workarounds

  1. Add explicit type annotations to all function and method parameters.
  2. Use type stubs or install third-party stubs for external libraries.
  3. Review and update type hints in your codebase for completeness.
  4. Review the Pyright configuration documentation for options to adjust or suppress this diagnostic if needed.

See Also