import { CallExpression , TypeChecker } from '@tsd/typescript' ; import { Diagnostic } from '../../interfaces' ; import { makeDiagnostic } from '../../utils' ; param checker param nodes return export const isNotAssignable = ( checker , nodes ) : Diagnostic [ ] => { const diagnostics = [ ] ; if ( ! nodes ) { return diagnostics ; } for ( const node of nodes ) { if ( ! node . typeArguments ) { continue ; } const expectedType = checker . getTypeFromTypeNode ( node . typeArguments [ 0 ] ) ; const argumentType = checker . getTypeAtLocation ( node . arguments [ 0 ] ) ; if ( checker . isTypeAssignableTo ( argumentType , expectedType ) ) { /**
             * The argument type is assignable to the expected type, we don't want this so add a diagnostic.
             */ diagnostics . push ( makeDiagnostic ( node , `Argument of type \`${ checker . typeToString ( argumentType ) }\` is assignable to parameter of type \`${ checker . typeToString ( expectedType ) }\`.` ) ) ; } } return diagnostics ; } ;