Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix closure compiler renaming safety. #465

Merged
merged 3 commits into from
Jan 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- ### Changed -->
<!-- ### Removed -->
<!-- ### Fixed -->
## Unreleased

### Fixed
* Fixed a bug where we broke compatibility with closure compiler's property renaming optimizations. JSCompiler_renameProperty can't be a module export ([#465](https://github.com/Polymer/lit-element/pull/465)).

## [2.0.0-rc.3] - 2019-01-18
### Fixed
Expand Down
12 changes: 11 additions & 1 deletion src/lib/updating-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@
* alias this function, so we have to use a small shim that has the same
* behavior when not compiling.
*/
export const JSCompiler_renameProperty = (prop: PropertyKey, _obj: any) => prop;
window.JSCompiler_renameProperty =
<P extends PropertyKey>(prop: P, _obj: unknown): P => prop;

declare global {
var JSCompiler_renameProperty: <P extends PropertyKey>(
prop: P, _obj: unknown) => P;

interface Window {
JSCompiler_renameProperty: typeof JSCompiler_renameProperty;
}
}

/**
* Converts property values to and from attribute values.
Expand Down
2 changes: 1 addition & 1 deletion src/lit-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import {TemplateResult} from 'lit-html';
import {render} from 'lit-html/lib/shady-render';

import {PropertyValues, UpdatingElement, JSCompiler_renameProperty} from './lib/updating-element.js';
import {PropertyValues, UpdatingElement} from './lib/updating-element.js';

export * from './lib/updating-element.js';
export * from './lib/decorators.js';
Expand Down