Skip to content

Replace local type declarations for polyfill APIs with those imported from the polyfills. #1208

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

Merged
merged 5 commits into from
Aug 6, 2021
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
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/chai": "^4.2.15",
"@types/mocha": "^5.2.4",
"@webcomponents/shadycss": "^1.10.2",
"@webcomponents/webcomponentsjs": "^2.5.0",
"@webcomponents/webcomponentsjs": "^2.6.0",
"chai": "^4.3.3",
"clang-format": "^1.5.0",
"downlevel-dts": "^0.7.0",
Expand Down
16 changes: 0 additions & 16 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
interface ShadyCSS {
styleElement(host: Element, overrideProps?: {[key: string]: string}): void;
getComputedStyleValue(element: Element, property: string): string;
ScopingShim: undefined|{
prepareAdoptedCssText(cssText: string[], name: string): void;
};
nativeShadow: boolean;
}

interface ShadyDOM {
inUse: boolean;
flush: () => void;
}

interface Window {
ShadyCSS?: ShadyCSS;
ShadyDOM?: ShadyDOM;
ShadowRoot: typeof ShadowRoot;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we still need ShadowRoot on window? Seems like that's in lib.dom.d.ts...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was limiting the PR to only removing the parts that are now provided externally, but it builds without a lot of other stuff in here. Should I remove those also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(FWIW, this declaration of ShadowRoot is not necesary, but the part below that adds adoptedStyleSheets still is.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think I'd rather wait to clean unrelated extra declarations out of here in another PR.

Copy link
Member Author

@bicknellr bicknellr Aug 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: Now that I think about it, lit/lit#1904 was probably a mistake that will become repairable once this PR (edit: and a PR removing the other unnecessary parts) is in. Originally, I found that those types were conflicting internally with something (the original JS externs for the polyfills, I think?) so that PR avoided the problem by not adding to Window. Now that the polyfill types all have exactly one definition, it might be better to go back to adding Lit-specific special properties to Window because they are actually there and a collision would indicate a real problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(We talked in a meeting about this, I'm going to go ahead and merge.)

}

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"include": [
"custom_typings/**/*.ts",
"node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.d.ts",
"src/**/*.ts"
],
"exclude": []
Expand Down