BETA
typescript
Nickname
Ruolo
Seleziona
Studente
Designer
Sviluppatore
Esploratore
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
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 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 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
Come si dichiara una variabile di tipo array di stringhe in TypeScript?
let arr: string[];
let arr: [string];
let arr: array<string>;
let arr: strings[];
Tempo residuo
Domanda
0
di
0
Come si crea un'interfaccia per un oggetto con proprietà nome (string) e età (number)?
interface Persona { nome: string, età: number }
interface Persona { nome: 'string'; età: 'number'; }
interface Persona { nome = string; età = number; }
interface Persona { nome: string; età: number; }
Tempo residuo
Domanda
0
di
0
Come si utilizza il tipo Partial in TypeScript?
let config: Optional<Config>;
let config: PartialConfig;
let config: Config?;
let config: Partial<Config>;
Tempo residuo
Domanda
0
di
0
Come si specifica una funzione come parametro di un'altra funzione in TypeScript?
function esegui(callback: function) {}
function esegui(callback: () -> void) {}
function esegui(callback: () => void) {}
function esegui(callback: void()) {}
Tempo residuo
Domanda
0
di
0
Come si definisce un tipo per un oggetto con proprietà facoltative?
interface User { nome: string?; }
interface User { nome?: string; }
interface User { ?nome: string; }
interface User { nome: ?string; }
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 è 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
Una tupla permette di specificare un array con un numero fisso di elementi di tipi specifici.
let persona: [string, number];
let persona: (string, number);
let persona: string | number;
let persona: {string, number};
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 Mapped in TypeScript?
type ReadonlyUser = { [K in keyof User]: User[K] };
type ReadonlyUser = { key in User };
type ReadonlyUser = { keyof User };
type ReadonlyUser = { K of User };
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
Qual è l'uso del tipo Extract<T, U> in TypeScript?
type Result = Extract<'a' & 'b' & 'c', 'a' | 'c'>;
type Result = Extract<'a' | 'b' | 'c', 'a' | 'c'>;
type Result = Extract<'a' | 'b' | 'c', 'b'>;
type Result = Extract<'a' | 'b' | 'c', 'a' & 'c'>;
Tempo residuo
Domanda
0
di
0