Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Typescript project errors in typing file

    Hi,
    I'm starting a project with smartclient and I want to use typescript. I'm getting type and syntax errors when i try to build. What am I doing wrong?

    Click image for larger version

Name:	smartclient_vscode_error.png
Views:	222
Size:	92.3 KB
ID:	264878

    #2
    Which exact npm package and version are you installing, and into what are you installing it? A React or Angular sample project? Can you provide repro instructions?
    Last edited by Isomorphic; 11 Mar 2021, 16:38.

    Comment


      #3
      Typescript 4.2.3, smart client 13 (tried with 12 stable aswell) In this example I'm not using any framework just plain typescript project. The goal is to use this as a standalone application which will consume asp.net core api.

      Can i find an example project somewhere? - smartclient only app but written with typescript

      Comment


        #4
        Our TypeScript definitions are intended for IDE autocompletion, inline docs, etc. You shouldn't be using our definitions with a transpiler or TypeScript verifier. They are only for IDE hints.

        With the way our docs describe how to use the TypeScript file, it should not have become involved in your transpilation process - so can you explain how you arrived at this error?

        Comment


          #5
          I did everything just like in docs.

          Here is my tsconfig.json
          {
          "compilerOptions": {
          "noEmitOnError": true,
          "noImplicitAny": true,
          "skipLibCheck": true,
          "sourceMap": true,
          "target": "ES6",
          "outDir": "../build"
          },
          "compileOnSave": true,
          "exclude": ["typings"]
          }

          I'm not trying to transpile smartclient.d.ts file, all I did was i added typings file as a reference at the beginning of index.ts file. Then when i try to compile with tsc I get the above mentioned error

          I must be doing something wrong thats not obvious to me....but can't seem to figure out what it is. Visual studio code is reporting syntax errors in d.ts file which adds to my confusion
          Last edited by hkrizan; 15 Mar 2021, 02:19.

          Comment


            #6
            So...I figured out what is the problem. There really are syntax errors in smartclient definition file

            for SmartClient_SNAPSHOT_v130d_2021-03-10_LGPL
            on line 98847 there is an extra semicolon
            static reloginCommFailureMessage;?: HTMLString;

            it should be:
            static reloginCommFailureMessage?: HTMLString;

            on line 134085 text "autoCenter new value for " is meant for param in comments
            setAutoCenter(autoCenter new value for autoCenter:any): void;

            it should be:
            setAutoCenter(autoCenter:any): void;


            Once I eliminated these syntax errors everything is working as expected.

            Comment


              #7
              Originally posted by hkrizan View Post
              I did everything just like in docs.

              :

              I must be doing something wrong thats not obvious to me....but can't seem to figure out what it is. Visual studio code is reporting syntax errors in d.ts file which adds to my confusion
              When you say, "just like in [the] docs," which docs are you referring to?

              Based on your VSCode screenshot, it looks like you're working with npm, so you'd want to look over the npm help topic, in particular the last section there on TypeScript. There we suggest moving smartclient.d.ts out from under the /assets directory, but in your case, try moving it out of /typings to another location. It need not be there for the IDE to pick it up for hover docs and autocompletion.

              Comment

              Working...
              X