microsoftgraph / msgraph-sdk-javascript

Microsoft Graph client library for JavaScript
https://graph.microsoft.com
MIT License
734 stars 223 forks source link

Missing types #124

Closed muthurathinam closed 5 years ago

muthurathinam commented 5 years ago

Moving this issue from msgraph-typescirpt-typings

Missing types in @microsoft/microsoft-graph-client's 1.3.0 release:

node_modules/@microsoft/microsoft-graph-client/lib/src/common.d.ts(41,39): error TS2304: Cannot find name 'RequestInit'. node_modules/@microsoft/microsoft-graph-client/lib/src/content/BatchRequestContent.d.ts(11,14): error TS2304: Cannot find name 'Request'. node_modules/@microsoft/microsoft-graph-client/lib/src/content/BatchRequestContent.d.ts(21,38): error TS2304: Cannot find name 'RequestInit'. node_modules/@microsoft/microsoft-graph-client/lib/src/content/BatchResponseContent.d.ts(54,41): error TS2304: Cannot find name 'Response'. node_modules/@microsoft/microsoft-graph-client/lib/src/content/BatchResponseContent.d.ts(59,33): error TS2304: Cannot find name 'Response'. node_modules/@microsoft/microsoft-graph-client/lib/src/content/BatchResponseContent.d.ts(64,55): error TS2304: Cannot find name 'Response'. node_modules/@microsoft/microsoft-graph-client/lib/src/tasks/LargeFileUploadTask.d.ts(42,28): error TS2304: Cannot find name 'File'. node_modules/@microsoft/microsoft-graph-client/lib/src/tasks/LargeFileUploadTask.d.ts(93,44): error TS2304: Cannot find name 'Blob'. node_modules/@microsoft/microsoft-graph-client/lib/src/tasks/LargeFileUploadTask.d.ts(107,42): error TS2304: Cannot find name 'Blob'. node_modules/@microsoft/microsoft-graph-client/lib/src/tasks/LargeFileUploadTask.d.ts(107,49): error TS2304: Cannot find name 'File'. node_modules/@microsoft/microsoft-graph-client/lib/src/tasks/OneDriveLargeFileUploadTask.d.ts(44,41): error TS2304: Cannot find name 'Blob'. node_modules/@microsoft/microsoft-graph-client/lib/src/tasks/OneDriveLargeFileUploadTask.d.ts(44,57): error TS2304: Cannot find name 'File'.

cc: @casz

muthurathinam commented 5 years ago

@casz Help me with the following:

  1. Is this something reproducible. If so please provide the repro steps.
  2. What is the editor that you are using.
  3. These are the typing which are available in the typescript's lib.dom.d.ts, have you included this in your project ?
sylvaingirardbe commented 5 years ago

I got the same problem runningtsc --project .\src\tsconfig.json.

tsconfig.json

{
    "compileOnSave": false,
    "compilerOptions": {
        "baseUrl": "/",
        "target": "es6",
        "lib": ["es6"],
        "types": [
            "reflect-metadata",
            "jest",
            "node"
        ],
        "module": "commonjs",
        "outDir": "dist",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "strictNullChecks": true
    },
    "typeRoots": [
        "node_modules/@types",
        "node_modules/@microsoft/microsoft-graph-client",
        "node_modules/@microsoft/microsoft-graph-types"
    ],
    "include": [
        "src/**/*.ts"
    ],
    "exclude": [
        "src/**/*.spec.ts"
    ]
}

tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../dist/app",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}
sylvaingirardbe commented 5 years ago

Ok, changing tsconfig.json to use "lib": ["es6", "dom"], did the trick.

muthurathinam commented 5 years ago

Closed as no response from the user cc: @casz

jetersen commented 5 years ago

tsconfig.json did the trick 😅

midgethoen commented 5 years ago

the readme says it can be user serverside. so I don't want to include "dom" in my tsconfig. isnt there a better solution for this?

silentorb commented 4 years ago

In a Node.js server project I ended up requiring this module instead of importing it to work around the type errors.

This module needs correct server typings.

matthew-carey-kidsloop commented 2 years ago

It is still an issue over a year later and the above solution does work, but it is not nice.

dmitry-yudakov commented 1 year ago

I managed to solve it using @tsconfig/node16, seemingly because of skipLibCheck setting in it.

"skipLibCheck": true