google / google/closure-compiler

Use last type signature for redefined methods in externs

Open
#1,214 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Currently, you cannot redefine an extern definition. While you can suppress the duplicate warning, the compiler still uses the original definition - not the later definition containing the override:

http://closure-compiler-debugger.appspot.com/#input0%3Ddocument.createElement('div').scrollIntoView(document.createElement(%2522div%2522))%253B%250A%26input1%26conformanceConfig%26externs%3D%252F**%2520%2540externs%2520*%252F%250A%250A%252F**%250A%2520*%2520%2540suppress%2520%257Bduplicate%257D%250A%2520*%2520%2540param%2520%257B(boolean%257CElement)%253D%257D%2520opt_top%250A%2520*%2520%2540see%2520http%253A%252F%252Fwww.w3.org%252FTR%252Fcssom-view%252F%2523dom-element-scrollintoview%250A%2520*%252F%250AElement.prototype.scrollIntoView%2520%253D%2520function(opt_top)%2520%257B%257D%253B%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_TYPES_NEW_INFERENCE%3D1

The same behavior occurs in both type systems.

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.