Different build result between npm and pnpm

86 views Asked by At

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.

0

There are 0 answers