Skip to content

Empty record type is not supported #4033

@fingerartur

Description

@fingerartur

Empty record type is not supported.

/**
 * @type {{}} // WARNING - [JSC_TYPE_PARSE_ERROR] Bad type annotation. type not recognized due to syntax error.
 */
const x = {}

I think it could be useful to have an empty record type. It comes in handy for example when dealing with React components.

Compiler Version: v20221102

Build command:

java -jar ./scripts/closureCompiler.jar \
  --entry_point=./src/js/index.js \
  --js=./src/**.js \
  --dependency_mode=PRUNE \
  --warning_level=VERBOSE \
  --js_output_file=./dist/bundle.js \
  --module_resolution=WEBPACK \
  --compilation_level=ADVANCED \
  --jscomp_error=checkDebuggerStatement \
  --jscomp_error=unusedLocalVariables \
  --jscomp_error=reportUnknownTypes \
  --jscomp_error=strictCheckTypes;

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage-doneHas been reviewed by someone on triage rotation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions