node-enumerable
node-enumerable copied to clipboard
Typescript semantic error: A type predicate's type must be assignable to its parameter's type
This comes from the index.d.ts, specifically these 3 functions:
function isNullOrEmpty<T>(seq: IEnumerable<T>): seq is (null | IEnumerable<T>);
function isUndefinedNullOrEmpty<T>(seq: IEnumerable<T>): seq is (undefined | null | IEnumerable<T>);
function isUndefinedOrEmpty<T>(seq: IEnumerable<T>): seq is (undefined | IEnumerable<T>);
I believe the correct semantics, also based on their names and what they should be able to accept as parameters is:
function isNullOrEmpty<T>(seq: null | IEnumerable<T>): seq is (null | IEnumerable<T>);
function isUndefinedNullOrEmpty<T>(seq: undefined | null | IEnumerable<T>): seq is (undefined | null | IEnumerable<T>);
function isUndefinedOrEmpty<T>(seq: undefined | IEnumerable<T>): seq is (undefined | IEnumerable<T>);
I am using typescript 2.7.2.
@SeanSobey
Do you use compiler options like strict?
Yes, here is the set of options I am using:
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"checkJs": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"module": "commonjs",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"pretty": true,
"skipLibCheck": false,
"sourceMap": true,
"strictNullChecks": true,
"strict": true,
"target": "es2017"
}