Skip to main content

TypeScript禁用规则

· One min read
Alan

原文 - How to Ignore and Disable TypeScript Rules

在TypeScript文件中禁用规则:

  • @ts-ignore – TypeScript-ESLint syntax for ignoring TypeScript rules
  • eslint-disable-next-line – ESLint and TypeScript-ESLint syntax for disabling non-ts rules
  • tslint:disable-next-line – deprecated TSLint syntax

例如:

// @ts-ignore
const num :number = 'A';