type Foo = { a: string; b: number; c: null; d: boolean; } // FooKeys type FooKeys = keyof Foo // How to declare a new type based on FooKeys, but without the values b and d? type FooKeysWithoutBD
Frontend
What does a component re-render in React depend on?
How to declare a new type based on Foo, but without fields a and c, without using Omit?
How to make try/catch construct work with Promise? How to make Promise synchronous using async/await?
In what order will console.log be output and why? Explain the order of execution of synchronous and asynchronous code (Event Loop, macro- and microtasks).
How to make a function with a Generic accept only a string or an instance of class Bar, and throw a TypeScript error in other cases?
What was your approach to writing CSS? Are you familiar with the CSS-in-JS approach?
function delayFunc(fn, delay) { return function c(...args) { return new Promise((resolve) => { setTimeout(() => { fn(...args) }, delay * 1000) }) } } function sum(a, b) { console.log(a + b) } const delayedSum = delayFunc(sum, 5); await delayedSum(3, 2); // after 5 seconds, outputs 5 await delayedSum(5, 3); // after 5 seconds from the previous, outputs 8
Why pass a function (c => c + 1) to setCount instead of just setCount(tick + 1)?
<div class="list"> <div class="item">1</div> <div class="item">2</div> ... <div class="item">N-1</div> <div class="item">N</div> </div>
Can the same be implemented through setTimeout instead of setInterval?
What is a dependencies array in useEffect? What happens if you pass an empty array or do not pass it at all?
Tell about the most complex task in your entire experience.
How to make the result type not 'any', but match the argument type using Generics?
There is an App component and a Rand component from a third-party library that outputs a random number. How to make the random number change every 3 seconds and display a counter of the number of changes? All in the App component.
// It is necessary to move the re-render logic to a separate external hook, // which allows working with the timer from outside (for example, stopping it after 10 seconds). // Create a new RandOnce component based on the Rand component, // which when used in App // will not update the random number every 3 seconds, but will output a random number only once.
How does the keyword 'type' differ from 'interface' in TypeScript? Explain inheritance in types and interfaces.
You have assessed the task, taken it on, and realize that you have estimated it incorrectly and cannot complete it on time. What do you do at this moment?
What ways are there to handle errors in Promise? Can try/catch be used?
Tell us about your work experience. How was the task planning process organized?