Typescript-react-starter: Compile Error: interface name must start with a capitalized I

Created on 26 Jul 2018  路  7Comments  路  Source: microsoft/TypeScript-React-Starter

I'm building my-app/src/components/Hello.tsx, and got this error:

(4,18): interface name must start with a capitalized I

image

.

and I need to fix it by adding 'I' before 'Props' to 'IProps':

export interface IProps {
    name: string;
    enthusiasmLevel?: number;
}

function Hello({name, enthusiasmLevel = 1} : IProps){

I think this error will influence all the place of interface name,

should I just update this part of README.md using PR first?

Most helpful comment

This can be solved with these rules (that solves also other problems ...) in your tslint.json

"rules": {
    "object-literal-sort-keys": false,
    "interface-name": false,
    "member-access": [true, "no-public"],
    "ordered-imports": false
  },

All 7 comments

I've seen that IProps is fixed in #172 ,but seems few places possibly need fix, I've not finished reading README.md, maybe I'll give it some check when I finish.

Will be good if this can be fixed, it might stumble many other newcomers.

Sorry I am working on my next job interviews these weeks, so I can't spend time on this issue recently,
if anyone is enthusiastic to fix it is welcome.

This can be solved with these rules (that solves also other problems ...) in your tslint.json

"rules": {
    "object-literal-sort-keys": false,
    "interface-name": false,
    "member-access": [true, "no-public"],
    "ordered-imports": false
  },

This can be solved with these rules (that solves also other problems ...) in your tslint.json

"rules": {
    "object-literal-sort-keys": false,
    "interface-name": false,
    "member-access": [true, "no-public"],
    "ordered-imports": false
  },

Not working now...!

{
"defaultSeverity": "error",
"extends": [
"
tslint:recommended"
],
"jsRules": {},
"rules": {
"class-name": false,
"trailing-comma": [ false ],
"no-console": false,
"only-arrow-functions": false,
"interface-name": [true, "never-prefix"]
},
"rulesDirectory": []
}
Update your interface rule as above, It seems to working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samblake picture samblake  路  5Comments

BenjaminWatts picture BenjaminWatts  路  6Comments

emanuelef picture emanuelef  路  3Comments

painreign picture painreign  路  6Comments

JukoPowel picture JukoPowel  路  3Comments