PrintPreview: Init <print-preview-model> settings in a type safe way.
Previously the 'settings' member variable was initialized as part of the Polymer property definition which is not type checked. Extracting the initialization to a helper createSettings() function makes the code have better TypeScript type coverage. For example after this change, adding any new properties without updating the Settings interface will throw a build time error as follows TS2353: Object literal may only specify known properties, and 'foo' does not exist in type 'Settings'. whereas previously it would erroneously pass type checking. Bug: 331681689 Change-Id: I47b480dfc56e36c76e8858ebda0679a991164af1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5420660 Reviewed-by:Rebekah Potter <rbpotter@chromium.org> Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org> Cr-Commit-Position: refs/heads/main@{#1282186}
Loading
Please register or sign in to comment