diff --git a/package.json b/package.json index d94cc1494e..de533bc54d 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,6 @@ "@babel/register": "^7.7.4", "@babel/runtime": "^7.7.6", "@types/jest": "^25.2.1", - "@types/modernizr": "^3.5.3", "@types/react": "16.9", "@types/react-dom": "^16.9.4", "autoprefixer": "^9.7.3", diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 6a5adec6d6..2e2f35f602 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -14,25 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -import "modernizr"; +import "matrix-react-sdk/src/@types/global"; import {Renderer} from "react-dom"; declare global { interface Window { - Modernizr: ModernizrAPI & FeatureDetects; - Olm: { - init: () => Promise; - }; - mxSendRageshake: (text: string, withLogs?: boolean) => void; matrixChat: ReturnType; // electron-only ipcRenderer: any; } - - // workaround for https://github.com/microsoft/TypeScript/issues/30933 - interface ObjectConstructor { - fromEntries?(xs: [string|number|symbol, any][]): object - } } diff --git a/src/vector/url_utils.ts b/src/vector/url_utils.ts index 6ebabfc4d1..d5efcdaaba 100644 --- a/src/vector/url_utils.ts +++ b/src/vector/url_utils.ts @@ -14,14 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ +import {urlSearchParamsToObject} from "matrix-react-sdk/src/utils/UrlUtils"; + interface IParamsObject { [key: string]: string; } -function searchParamsToObject(params: URLSearchParams) { - return Object.fromEntries([...params.entries()]); -} - // We want to support some name / value pairs in the fragment // so we're re-using query string like format // @@ -42,11 +40,11 @@ export function parseQsFromFragment(location: Location) { }; if (hashparts.length > 1) { - result.params = searchParamsToObject(new URLSearchParams(hashparts[1])); + result.params = urlSearchParamsToObject(new URLSearchParams(hashparts[1])); } return result; } export function parseQs(location: Location) { - return searchParamsToObject(new URLSearchParams(location.search)); + return urlSearchParamsToObject(new URLSearchParams(location.search)); }