Registry / ai-ml / gd-sprest-def

gd-sprest-def

JSON →
library2.1.3jsnpmunverified

TypeScript definition files generated from the $metadata REST endpoint for SharePoint, providing type-safe access to SharePoint REST APIs. Current stable version is 2.1.3, updated as needed to match SharePoint changes. It is designed to be used with the gd-sprest library, offering auto-generated interfaces for SharePoint entities (SP, MS, OBA, PS, SPO) directly from the OData metadata. Key differentiator: eliminates manual TypeScript definitions by reflecting the actual server metadata, ensuring accuracy and up-to-date types. This library is not standalone; it requires async loading at runtime for full functionality.

npm install gd-sprest-def
INSTALL
IMPORT
SIG · GD-SPREST-DEF
G
gd-sprest-def
ai-mljavascriptv2.1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SP
import { SP } from 'gd-sprest-def';
import * as SP from 'gd-sprest-def';
Named export, not a namespace. Allows tree-shaking.
Microsoft
import { Microsoft } from 'gd-sprest-def';
For SharePoint-related Microsoft Graph entities.
PS
import { PS } from 'gd-sprest-def';
const PS = require('gd-sprest-def').PS;
ESM-only package; CommonJS require will work but is not recommended.

Demonstrates importing multiple definition modules and using SP.Web to fetch lists, showing type-safe async API usage.

import { SP, MS, OBA, PS, SPO } from 'gd-sprest-def'; // Example: List all lists in a SharePoint site async function getLists() { const lists = await SP.Web.get('/sites/mysite').lists(); console.log(lists); // Types are fully defined: lists is SP.ListCollection<SP.List> } getLists().catch(err => console.error(err));
Debug
Known issues
breakingRemoved CommonJS exports and flat file structure; uses ESM named exports only in v2.x.
fix
Update imports to use { SP } from 'gd-sprest-def' instead of 'require' or default import.
affects: >=2.0.0
deprecatedDirect use of definition files without the async loader from gd-sprest may cause runtime errors.
fix
Ensure gd-sprest's async loader is invoked before using these definitions, or use dynamic import if using in isolation (not recommended).
affects: >=1.0.0
gotchaDefinitions are auto-generated from a specific SharePoint tenant's metadata; they may not cover all customizations or on-premises differences.
fix
Generate fresh definitions against your target environment using the gd-sprest-def build script if types mismatch.
affects: all
Errors
Common errors & fixes
Cannot find module 'gd-sprest-def' or its corresponding type declarations.
Missing installation or incorrect import style in a TypeScript project without @types.
fix
Install the package: npm install gd-sprest-def. Ensure tsconfig.json includes node_modules in typeRoots or uses 'types': ['gd-sprest-def'].
Module not found: Error: Can't resolve 'gd-sprest-def' in '/path/to/project'
Webpack or bundler cannot resolve the ESM package. Possibly missing file extension or wrong path.
fix
Add resolve.fullySpecified: false to webpack config, or use proper import path: import { SP } from 'gd-sprest-def'.
Type 'SP' is not assignable to type 'SP'.
Conflicting local type with the same name imported from both gd-sprest-def and gd-sprest/lib.
fix
Use type import: import type { SP } from 'gd-sprest-def' and use it only as a type, not a value.
Upgrade
Version history
2.1.3latest on npm
Audit
Dependencies
gd-sprestrequiredPrimary library that consumes these definitions; this package provides types for it.
tslintoptionalPeer dependency for linting TypeScript, referenced in the lib's setup.
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
gd-sprest-def — npm install gd-sprest-def · libregistry