classGreeter{readonly name:string='world';constructor(otherName?:string){if(otherName !==undefined){this.name= otherName;}}err(){this.name='not ok';// Cannot assign to 'name' because it is a read-only property.}}const g =newGreeter();g.name='also not ok';// Cannot assign to 'name' because it is a read-only property.
classBase{greet(){console.log('Hello, world!');}}classDerivedextendsBase{// Make this parameter requiredgreet(name:string){// Property 'greet' in type 'Derived' is not assignable to the same property in base type 'Base'.// Type '(name: string) => void' is not assignable to type '() => void'.console.log(`Hello, ${name.toUpperCase()}`);}}const b:Base=newDerived();// Crashes because "name" will be undefinedb.greet();
abstractclassBase{abstractgetName():string;printName(){console.log('Hello, '+this.getName());}}classDerivedextendsBase{getName(){return'world';}}const d =newDerived();d.printName();
var person ={name:['Bob','Smith'],age:32,gender:'male',interests:['music','skiing'],bio:function(){alert(this.name[0]+' '+this.name[1]+' is '+this.age+' years old. He likes '+this.interests[0]+' and '+this.interests[1]+'.',);},greeting:function(){alert("Hi! I'm "+this.name[0]+'.');},};
<template><div><h1v-if="error.statusCode === 404">Page not found</h1><h1v-else>An error occurred</h1><NuxtLinkto="/">Home page</NuxtLink></div></template><script>exportdefault{props:['error'],layout:'error',// you can set a custom layout for the error page};</script>
warning: Pulling without specifying how to reconcile divergent branches isdiscouraged. You can squelch this message by running one of the followingcommands sometime before your next pull:git config pull.rebase false# merge (the default strategy)git config pull.rebase true# rebasegit config pull.ff only # fast-forward onlyYou can replace "git config" with "git config --global" to set a defaultpreference for all repositories. You can also pass --rebase, --no-rebase,or --ff-only on the command line to override the configured default perinvocation.