BETA
typescript
Nickname
Ruolo
Seleziona
Studente
Designer
Sviluppatore
Esploratore
Come si definisce un array di numeri in TypeScript?
let numeri: number[];
let numeri: [number];
let numeri: array<number>;
let numeri: numbers[];
Tempo residuo
Domanda
0
di
0
Come si crea un tipo alias in TypeScript?
alias ID = string | number;
let ID: string | number;
type ID = string | number;
typedef ID = string | number;
Tempo residuo
Domanda
0
di
0
Come si fa a specificare che una funzione può restituire più tipi in TypeScript?
function getId(): string || number {}
function getId(): string, number {}
function getId(): string | number {}
function getId(): [string, number] {}
Tempo residuo
Domanda
0
di
0
Come si definisce un parametro con valore predefinito in una funzione TypeScript?
function saluta(nome: string = 'Guest') {}
function saluta(nome: ?string = 'Guest') {}
function saluta(nome: string ?= 'Guest') {}
function saluta(nome = 'Guest': string) {}
Tempo residuo
Domanda
0
di
0
Qual è la sintassi corretta per dichiarare una variabile di tipo string in TypeScript?
let nome = 'string';
let nome: string;
string nome;
nome: string;
Tempo residuo
Domanda
0
di
0
Come si specifica un parametro opzionale in una funzione TypeScript?
function saluta(?nome: string) {}
function saluta(nome?: string) {}
function saluta(nome: string?) {}
function saluta(opzionale nome: string) {}
Tempo residuo
Domanda
0
di
0
Come si definisce una classe astratta in TypeScript?
abstract class Forma {}
class abstract Forma {}
class Forma abstract {}
abstract Forma class {}
Tempo residuo
Domanda
0
di
0
Qual è il risultato dell'assegnazione 'let x: never = 5;' in TypeScript?
x sarà undefined
Errore di compilazione
x sarà null
x sarà 5
Tempo residuo
Domanda
0
di
0
Come si usa l'operatore as per il type assertion in TypeScript?
let valore = (input as string);
let valore = (input: string);
let valore = <string>input;
let valore = string(input);
Tempo residuo
Domanda
0
di
0
Come si estende un'interfaccia in TypeScript?
interface Admin implements User {}
interface Admin inherit User {}
interface Admin extends User {}
interface Admin include User {}
Tempo residuo
Domanda
0
di
0
Qual è lo scopo del tipo unknown in TypeScript?
Un tipo che può essere assegnato solo a never
Un tipo che rappresenta un valore sconosciuto
Un tipo che può essere assegnato solo a any
Un tipo che rappresenta un valore nullo
Tempo residuo
Domanda
0
di
0
Come si definisce un'interfaccia con una proprietà facoltativa in TypeScript?
interface Persona { nome: string?; }
interface Persona { ?nome: string; }
interface Persona { nome: ?string; }
interface Persona { nome?: string; }
Tempo residuo
Domanda
0
di
0
Qual è lo scopo dell'operatore keyof in TypeScript?
Verifica se una chiave esiste in un oggetto
Combina più tipi in uno
Restituisce le chiavi di un tipo
Converte un tipo in una stringa
Tempo residuo
Domanda
0
di
0
Come si usa l'operatore in nelle definizioni dei tipi in TypeScript?
type Options = { [K in 'option1' | 'option2']: boolean };
type Options = { K in 'option1' | 'option2': boolean };
type Options = { 'option1' & 'option2': boolean };
type Options = { K of 'option1' | 'option2': boolean };
Tempo residuo
Domanda
0
di
0
Come si utilizza il tipo Readonly<T> in TypeScript?
type ReadOnlyUser = Readonly<User>;
type ReadOnlyUser = Const<User>;
type ReadOnlyUser = Static<User>;
type ReadOnlyUser = Final<User>;
Tempo residuo
Domanda
0
di
0
Come si usa il tipo Exclude<T, U> in TypeScript?
type Result = Exclude<'a' & 'b' & 'c', 'a' | 'c'>;
type Result = Exclude<'a' | 'b' | 'c', 'a' | 'c'>;
type Result = Exclude<'a' | 'b' | 'c', 'a' & 'c'>;
type Result = Exclude<'a' | 'b' | 'c', 'b'>;
Tempo residuo
Domanda
0
di
0
Cosa fa il tipo ReturnType<T> in TypeScript?
Restituisce tutti i tipi di una funzione
Verifica se un tipo è una funzione
Combina i tipi di input di una funzione
Restituisce il tipo di ritorno di una funzione
Tempo residuo
Domanda
0
di
0
Come si usa ReadonlyArray<T> in TypeScript?
const arr: Array<number> = [1, 2, 3];
const arr: readonly number[] = [1, 2, 3];
const arr: ImmutableArray<number> = [1, 2, 3];
const arr: ReadonlyArray<number> = [1, 2, 3];
Tempo residuo
Domanda
0
di
0