Typescript Contructor Parameters. Parsing error: Unexpected reserved word 'public'

I wanted to create class in typescritp + react
I decided to use Typescript constructor parameters
But I have an error during compilation when i do that.

That is my UserData class

enum SecurityRole {
    USER = "USER",
    ADMIN= "ADMIN"
}
export class UserData {
    constructor(public name: string, readonly securityRole = SecurityRole.USER) { }
}
export const createUserDataFromJson = (json: any): UserData => {
    console.log(`user from json : ` + json)
    return new UserData(json.name, json.securityRole)
}

But i have received an error:

  Line 8:17:  Parsing error: Unexpected reserved word 'public'

   6 | }
   7 | export class UserData {
>  8 |     constructor(public name: string, readonly securityRole = SecurityRole.USER) { }
     |                 ^
   9 | }
  10 | export const createUserDataFromJson = (json: any): UserData => {
  11 |     console.log(`user from json : ` + json)

I figured that it might be someting with tsconfig.json so here it is:

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "esnext",
    "strict": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": [
    "src"
  ]
}

I am using npm run build this is react-scripts build in my project (4.0.2)

npm version 6.14.6
node version v12.18.3

Have i done anything wrong there? or is it something with my project settings?

229 thoughts on “Typescript Contructor Parameters. Parsing error: Unexpected reserved word 'public'”

  1. I have been exploring for a little bit for any high quality articles or weblog posts on this sort of house .
    Exploring in Yahoo I at last stumbled upon this website.
    Studying this info So i’m glad to express that I’ve an incredibly good uncanny feeling I found out exactly what I needed.
    I so much indisputably will make sure to don?t overlook this web site and provides it
    a glance regularly. http://www.deinformedvoters.org/dapoxetine-60mg

    Reply
  2. We are a group of volunteers and opening
    a new scheme in our community. Your website offered us with valuable
    information to work on. You’ve done an impressive job and our whole community
    will be thankful to you.

    Reply
  3. I’m really inspired with your writing skills and also with the format to your weblog.
    Is this a paid topic or did you customize it yourself?
    Anyway stay up the excellent quality writing, it is uncommon to look a nice weblog like this one these days..

    Reply
  4. Howdy! Do you know if they make any plugins to help with SEO?
    I’m trying to get my blog to rank for some targeted keywords
    but I’m not seeing very good success. If you know of
    any please share. Many thanks!

    Reply
  5. Hello my loved one! I want to say that this article is amazing,
    great written and come with almost all significant infos.
    I would like to look more posts like this .

    Reply
  6. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to
    my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with
    something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

    Reply
  7. Hmm it seems like your site ate my first comment (it was
    super long) so I guess I’ll just sum it up what
    I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to the whole thing.

    Do you have any suggestions for newbie blog writers?
    I’d really appreciate it.

    Reply
  8. Hmm it seems like your blog ate my first comment (it was super
    long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog writer but I’m still new to everything.
    Do you have any recommendations for newbie blog writers?
    I’d really appreciate it.

    Reply
  9. I would like to thank you for the efforts you have put in writing this site.

    I am hoping to view the same high-grade content by
    you in the future as well. In truth, your creative writing
    abilities has motivated me to get my very own site now 😉

    Reply
  10. Hi there very nice site!! Man .. Beautiful .. Amazing ..
    I’ll bookmark your blog and take the feeds additionally?
    I am satisfied to find numerous useful info here within the publish, we’d like work
    out more techniques in this regard, thank you for sharing.

    . . . . .

    Reply
  11. I just like the helpful info you supply in your articles.

    I’ll bookmark your blog and check again right here regularly.
    I am rather certain I’ll be informed a lot of new stuff right here!

    Good luck for the next!

    Reply
  12. An outstanding share! I’ve just forwarded this onto a coworker who has been conducting a little research on this.
    And he actually ordered me dinner simply because I found it for him…
    lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending time to discuss
    this issue here on your website.

    Reply
  13. Evidently that the bigger the number, the more photographs, music and knowledge it is possible for you to
    to save lots of on the card. Indulge within the divine
    online shopping experience and save on time and energy.
    In truth it can be an easier slot for just about any student
    to get liberated out of the massive debt very quickly. Using the familiar symbols and
    not complicating the play with advanced sport options, there’s a trendy twist with a
    video slot look. The brand new Apple The Apple MacBook Pro 17 comes kitted with a 8x slot-loading SuperDrive,
    built-in microphone, Stereo speakers with subwoofers and FaceTime HD digital
    camera for video chatting. The brand new Apple MacBook Pro 17 are full of cutting-edge features.
    This operating system is simple, highly effective and has options like Multi-Touch
    gesture and Mission Control which lets the customers to work together
    with this laptop computer in a intuitive approach.

    Reply
  14. Υοu аctually make іt ѕhow uⲣ actually easy collectively with ʏоur presentation neᴠertheless Ӏ tо
    uncover tһiѕ mаke ɑ difference t᧐ ƅe truly one tһing thаt І believe І ѡould ƅy no mеɑns understand.
    Ιt appears aѕ well complicated and really huge fօr me.

    Ι’m searching forward ߋn ʏοur subsequent place uⲣ, Ӏ will ϲonsider to ցet the
    grasp ⲟf it!

    my website :: Jade

    Reply

Leave a Comment