Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Identity] Precise Typechecking #31870

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

deyaaeldeen
Copy link
Member

@deyaaeldeen deyaaeldeen commented Nov 21, 2024

Follows the same recipe in #31786, more specifically:

  • Enables typechecking tests and fix errors
  • Fixes lint warnings in tests
  • Removes unneeded tsconfig compiler options
  • Uses modern ES2023 target when building samples and tests
  • Rewrites import paths in tests to target @azure/identity in public tests and the compiled esm in internal tests
  • Fix npm commands for running tests to conform to how vitest tests are configured

Live run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4360514&view=results

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@deyaaeldeen deyaaeldeen removed the request for review from glharper November 21, 2024 21:39
Comment on lines +18 to +19
import { DeveloperSignOnClientId } from "../../../dist/esm/constants.js";
import { IdentityClient } from "../../../dist/esm/client/identityClient.js";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a public test and I wonder why are these imported from internal code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware that we're not able to - so that's a little surprising to me. With that said, identity has been around fro a while and drifts in a few ways from the rest of the packages I suppose. With that said, just like everywhere else we should be importing from src not dist

import { ClientSecretCredential } from "../../../src/credentials/clientSecretCredential.js";
import { IdentityClient } from "../../../src/client/identityClient.js";
import { ClientSecretCredential } from "../../../dist/esm/credentials/clientSecretCredential.js";
import { IdentityClient } from "../../../dist/esm/client/identityClient.js";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KarishmaGhiya This is a public test and I wonder why are these imported from internal code.

Copy link
Member

@maorleger maorleger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like Karishma and Minh-Anh to review the config changes but my one concern right now is the imports from dist. Thanks for taking this on!


return false;
}
export * from "./cred.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you help me understand why this change is needed? What was wrong with the existing index file?

import type { AuthenticationError } from "../src/index.js";
import { AzureAuthorityHosts } from "../src/index.js";
import type { AuthenticationError } from "@azure/identity";
import { AzureAuthorityHosts } from "@azure/identity";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not import it from src?

import type { AccessToken, GetTokenOptions, TokenCredential } from "../../src/index.js";
import type { CredentialLogger } from "../../src/util/logging.js";
import type { AccessToken, GetTokenOptions, TokenCredential } from "@azure/identity";
import type { CredentialLogger } from "../../dist/esm/util/logging.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something doesn't seem right - we should not be importing from "../../dist" i don think? Same for every import from dist

Comment on lines +18 to +19
import { DeveloperSignOnClientId } from "../../../dist/esm/constants.js";
import { IdentityClient } from "../../../dist/esm/client/identityClient.js";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware that we're not able to - so that's a little surprising to me. With that said, identity has been around fro a while and drifts in a few ways from the rest of the packages I suppose. With that said, just like everywhere else we should be importing from src not dist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

3 participants