1

Recently, I have used pnpm instead of npm in the program. I built the project(pnpm run build) and received a ts error. (ts-loader in the webpack) It seems a TS error. but when I used npm it didn't throw errors(npm run build). Is there any difference between pnpm and npm cli?

export enum NormalisableDataType {
 A,
 B,
 C,
 D
}
...
const rawPollutantValueBands = {
 [`${NormalisableDataType.D}`]: 'sth'
};
...
export function normaliseRawReadingsToDysonAirQualityLevel(
 dataType: NormalisableDataType
) {
 const currentValueBands = dataType[normalisableDataType];
 ...
}

error message is Element implicitly has an 'any' type because expression of type 'NormalisableDataType' can't be used to index type '{ 3: string; }'. It seems a right TS check error.

asked Oct 23, 2023 at 7:49

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.