make URI#from more strict and URI#with more clear wrt schme-enforcement, #56108

This commit is contained in:
Johannes Rieken 2018-08-10 11:50:41 +02:00
parent 4fa87ebca6
commit 48e118bb84
2 changed files with 7 additions and 7 deletions

View file

@ -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,

10
src/vs/monaco.d.ts vendored
View file

@ -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;