import * as ts from "typescript" ; import * as Lint from "tslint" ; import * as utils from "tsutils/typeguard/2.8" ; import { createInvalidNode , CheckNodeResult , createCheckNodeRule } from "./shared/check-node" ; type Options = { } ; export const Rule = createCheckNodeRule ( checkNode , "Only the same kind of members allowed in interfaces." ) ; function checkNode ( node , _ctx ) { const invalidNodes = [ ] ; if ( utils . isInterfaceDeclaration ( node ) ) { let prevMemberKind = undefined ; let prevMemberType = undefined ; for ( const member of node . members ) { const memberKind = member . kind ; let memberType = 0 ; if ( utils . isPropertySignature ( member ) && member . type && utils . isFunctionTypeNode ( member . type ) ) { memberType = member . type . kind ; } if ( prevMemberKind !== undefined && ( prevMemberKind !== memberKind || prevMemberType !== memberType ) ) { invalidNodes . push ( createInvalidNode ( member , [ ] ) ) ; } prevMemberKind = memberKind ; prevMemberType = memberType ; } } return { invalidNodes } ; }