Answer the question
In order to leave comments, you need to log in
How to type an application?
I'm learning TS. I am writing an attachment, some questions arise, and here is one of them?
Is it worth typing 100% into an application on react + redux i.e. in general, everything, and components and redax and a folder with utilities?
How "Deep" is it worth optimizing specific functions, for example:
export const getLinksOnPage = (): string[] => {
const allLinksOnPage : NodeListOf<HTMLImageElement> = document.querySelectorAll('img');
return Array.from(allLinksOnPage).map(item => item.src);
};
NodeListOf<HTMLImageElement>
) with which I do not quite agree, i.e. I'm not sure if such things should be typed at all, can there be problems here - I'm not sure, BUT there are problems that I want to do some things in code, let's say [...new Set(arr)]
, to get only unique elements of the array, and ts swears and there are a lot of such moments where I write the code is not exactly how I want, but how ts forces me. Do you think it's worth typing everything at all?
Answer the question
In order to leave comments, you need to log in
ts swears and there are a lot of such moments where I write the code not quite the way I want, but how ts makes me
But inside the function there is also, say, such an intermediate typing (NodeListOf) with which I do not quite agree
Do you think it's worth typing everything at all?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question