Convert files from JavaScript to TypeScript
Change-Id: Id5e5dae3f06c65fb6e9cd340e528799d117b2f3a
This commit is contained in:
@@ -16,5 +16,4 @@
|
||||
*/
|
||||
|
||||
// Place all code related to font-roboto-local here
|
||||
import '@polymer/font-roboto-local/roboto.js';
|
||||
|
||||
import '@polymer/font-roboto-local/roboto';
|
||||
|
||||
@@ -14,9 +14,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {initAppContext} from '../services/app-context-init.js';
|
||||
import {initVisibilityReporter, initPerformanceReporter, initErrorReporter} from '../services/gr-reporting/gr-reporting_impl.js';
|
||||
import {appContext} from '../services/app-context.js';
|
||||
import {initAppContext} from '../services/app-context-init';
|
||||
import {
|
||||
initVisibilityReporter,
|
||||
initPerformanceReporter,
|
||||
initErrorReporter,
|
||||
} from '../services/gr-reporting/gr-reporting_impl';
|
||||
import {appContext} from '../services/app-context';
|
||||
|
||||
if (!window.Polymer) {
|
||||
window.Polymer = {
|
||||
|
||||
@@ -60,3 +60,4 @@ var GrDisplayNameUtils;
|
||||
var GrReviewerSuggestionsProvider;
|
||||
var page;
|
||||
var util;
|
||||
var Polymer: any;
|
||||
|
||||
@@ -20,12 +20,11 @@ const SAFE_URL_PATTERN = /^(https?:\/\/|mailto:|[^:/?#]*(?:[/?#]|$))/i;
|
||||
/**
|
||||
* Wraps a string to be used as a URL. An error is thrown if the string cannot
|
||||
* be considered safe.
|
||||
*
|
||||
* @constructor
|
||||
* @param {string} url the unwrapped, potentially unsafe URL.
|
||||
*/
|
||||
class SafeUrl {
|
||||
constructor(url) {
|
||||
private readonly _url: string;
|
||||
|
||||
constructor(url: string) {
|
||||
if (!SAFE_URL_PATTERN.test(url)) {
|
||||
throw new Error(`URL not marked as safe: ${url}`);
|
||||
}
|
||||
@@ -41,10 +40,8 @@ export const _testOnly_SafeUrl = SafeUrl;
|
||||
|
||||
/**
|
||||
* Get the string representation of the safe URL.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
export function safeTypesBridge(value, type) {
|
||||
export function safeTypesBridge(value: unknown, type: string): unknown {
|
||||
// If the value is being bound to a URL, ensure the value is wrapped in the
|
||||
// SafeUrl type first. If the URL is not safe, allow the SafeUrl constructor
|
||||
// to surface the error.
|
||||
|
||||
Reference in New Issue
Block a user