google / google/closure-compiler

Clearer error message when a class extends an interface

Open
#1,643 6 comments 0 reactions 1 assignee Claimed by @Dominator008 View on GitHub
enhancement OTI
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

https://closure-compiler-debugger.appspot.com/#input0%3D%252F**%2520%2540interface%2520*%252F%250Aclass%2520MyInterface%2520%257B%257D%250A%250Aclass%2520MyClass%2520extends%2520MyInterface%2520%257B%257D%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1

Currently this gives two different errors, and one of them mentions `$jscomp.inherits` which is totally unhelpful and meaningless to the user. We should:
1. Only report one error
2. Make sure it's clear
3. (bonus) Suggest that the user probably meant to include an `@implements` annotation in their JSDoc, rather than writing `extends`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.