From 48e118bb84133850253096137c2f33c1647b34e0 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 10 Aug 2018 11:50:41 +0200 Subject: [PATCH] make URI#from more strict and URI#with more clear wrt schme-enforcement, #56108 --- src/vs/base/common/uri.ts | 4 ++-- src/vs/monaco.d.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/vs/base/common/uri.ts b/src/vs/base/common/uri.ts index 5fe794d4581..4a6f69ea626 100644 --- a/src/vs/base/common/uri.ts +++ b/src/vs/base/common/uri.ts @@ -191,7 +191,7 @@ export default class URI implements UriComponents { // ---- modify to new ------------------------- - public with(change: { scheme?: string; authority?: string; path?: string; query?: string; fragment?: string }): URI { + public with(change: { scheme?: string; authority?: string | null; path?: string | null; query?: string | null; fragment?: string | null }): URI { if (!change) { return this; @@ -307,7 +307,7 @@ export default class URI implements UriComponents { return new _URI('file', authority, path, _empty, _empty); } - public static from(components: { scheme?: string; authority?: string; path?: string; query?: string; fragment?: string }): URI { + public static from(components: { scheme: string; authority?: string; path?: string; query?: string; fragment?: string }): URI { return new _URI( components.scheme, components.authority, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 18baa911399..b8394da57dc 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -163,10 +163,10 @@ declare namespace monaco { readonly fsPath: string; with(change: { scheme?: string; - authority?: string; - path?: string; - query?: string; - fragment?: string; + authority?: string | null; + path?: string | null; + query?: string | null; + fragment?: string | null; }): Uri; /** * Creates a new Uri from a string, e.g. `http://www.msft.com/some/path`, @@ -199,7 +199,7 @@ declare namespace monaco { */ static file(path: string): Uri; static from(components: { - scheme?: string; + scheme: string; authority?: string; path?: string; query?: string; -- GitLab