const bobHome: absPath1 = ['', 'home', 'bob'];
const timHome: absPath2 = ['', 'home', 'tim'];
const userMusic: relPath1 = ['Multimedia', 'Music' ]; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const userVideos: relPath2 = ['Multimedia', 'Videos']; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const bobMusic: absPath1 = [...bobHome, ...userMusic ]; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const timVideos: absPath2 = [...timHome, ...userVideos]; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const bobConfig: absPath1 = [...bobHome, '.config']; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const timSSH : absPath2 = [...timHome, '.ssh' ]; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const bobHack: absPath1 = ['', ...bobHome.split(1)]; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const timHack: absPath1 = ['', ...bobHome.split(1)]; //<-- Property '0' is missing in type 'string[]' but required in type 'absPath'.ts(2741)
const bobLoop: absPath1 = (() => {
const accumulator = [];
for (let i = 0, i < userMusic.length, i++) accumulator.push(userMusic[i]);
return accumulator;
})()
type relPath1 = [...string[]];
type absPath1 = ['', ...string[]];
interface relPath2 extends Array<string> {
[n: number]: string;
}
interface absPath2 extends relPath2 {
0: '';
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.