Skip to content

SOLUTION: SPFx 1.5.0 wrong typings in package.json causing lots of problems #2093

@vsoderholm

Description

@vsoderholm

I had some problems with MSGraphClient and AadHttpClient in 1.5.0, which after some digging seems to be caused by incorrect typings references in each and every one of the @microsoft/sp-xxx/package.json files.

it says
"typings": "dist/index-internal.d.ts",

..but it should probably be
"typings": "lib/index.d.ts",

Fixing this fixed my problems and made my ts-code compile again 🥇

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

Since it has main: "lib/index.js" in package.json, one would expect that the typings would be the same as the actual used code files, and not from the dist folders.

Observed Behavior

Typescript typings missing a shitload of stuff when developing your thingy.

Steps to Reproduce

for example, import {AadHttpClient} from '@microsoft/sp-http';
and then try to do const ahc = new AadHttpClient(scope, endpoint
and it will incorrectly say "no 2 param constructor".

the typings in sp-http/dist/index-internal.d.ts misses this and says
/* Excluded from this release type: __constructor */ on line 42.

this causes the error, but if you apply my suggested fix to use lib/index.d.ts instead, it will correctly via sp-http/lib/index.d.ts, reference the constructor on line 32 in sp-http/lib/AadHttpClient/AAdHttpClient.d.ts
constructor(serviceScope: ServiceScope, resourceEndpoint: string);

Submission Guidelines

So, you could just silently fix this in the npm packages maybe? ❤️

Thanks for your contribution! Sharing is caring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:spfxCategory: SharePoint Framework (not extensions related)status:fixedIssue was fixed in current or prior release.status:trackedCurrently tracked with Microsoft’s internal issue tracking system. DO NOT ADD/REMOVE (MSFT managed)type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions