Observed at commit 2eb7ed4: cursor-sdk/skills/cursor-sdk/references/auth.md line 45.
The text reads:
The non-null assertion (!) is a readable way to say "fail loudly if the env var is missing" — otherwise the SDK will throw an auth error later and the stack trace won't point at the env var.
for the example apiKey: process.env.CURSOR_API_KEY!.
Problem
In TypeScript the postfix ! is a compile-time-only assertion; it is erased in emitted JavaScript and performs no runtime check. If CURSOR_API_KEY is unset, undefined is passed through and the failure appears later in the SDK, exactly the outcome the sentence says ! avoids.
Suggested fix
Reword to say that ! only silences the type error and does no check, and lead with the explicit check that is already shown a few lines below:
const apiKey = process.env.CURSOR_API_KEY;
if (!apiKey) {
console.error("Missing CURSOR_API_KEY. ...");
process.exit(1);
}
Observed at commit 2eb7ed4:
cursor-sdk/skills/cursor-sdk/references/auth.mdline 45.The text reads:
for the example
apiKey: process.env.CURSOR_API_KEY!.Problem
In TypeScript the postfix
!is a compile-time-only assertion; it is erased in emitted JavaScript and performs no runtime check. IfCURSOR_API_KEYis unset,undefinedis passed through and the failure appears later in the SDK, exactly the outcome the sentence says!avoids.Suggested fix
Reword to say that
!only silences the type error and does no check, and lead with the explicit check that is already shown a few lines below: