Registry / type-stubs / fastcomments-typescript

fastcomments-typescript

JSON →
library3.0.13jsnpmunverified

This package, `fastcomments-typescript`, provides a comprehensive set of TypeScript type definitions for interacting with the FastComments platform. It includes types for API models, such as comment data structures and user profiles, as well as request and response bodies for various API operations (e.g., creating or updating comments). Additionally, it defines types for widget configurations, ensuring type safety when embedding and customizing the FastComments widget within a TypeScript application. The current stable version is 3.0.13. Release cadence typically aligns with updates to the FastComments API and SDK, ensuring type definitions remain consistent with the latest platform features. Its key differentiator is providing official, precise type guidance for developers integrating with FastComments, minimizing runtime errors related to data shape mismatches.

npm install fastcomments-typescript
INSTALL
IMPORT
SIG · FASTCOMMENTS-TYPES
F
fastcomments-typescript
type-stubsjavascriptv3.0.13
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

Comment
import type { Comment } from 'fastcomments-typescript';
import { Comment } from 'fastcomments-typescript';
Use 'import type' for type-only imports to ensure they are erased at compile-time and prevent accidental runtime dependency.
CreateCommentRequest
import type { CreateCommentRequest } from 'fastcomments-typescript';
import CreateCommentRequest from 'fastcomments-typescript';
Most API model types are named exports. The package ships ESM-only type definitions.
WidgetConfig
import type { WidgetConfig } from 'fastcomments-typescript';
const WidgetConfig = require('fastcomments-typescript');
This package is designed for TypeScript environments and ESM consumption. CommonJS 'require' will not correctly resolve type definitions.

This quickstart demonstrates how to import and use core FastComments types (Comment, CreateCommentRequest, WidgetConfig) to define data structures, enhancing type safety in your application.

import type { Comment, CreateCommentRequest, WidgetConfig } from 'fastcomments-typescript'; // Example: Defining a comment object received from the API const myComment: Comment = { id: 'some-comment-id-123', userId: 'user-456', text: 'This is an example comment.', createdAt: new Date().toISOString(), author: { id: 'user-456', displayName: 'Example User', profileUrl: 'https://example.com/users/456', avatarURL: 'https://example.com/avatars/456.png' }, status: 'APPROVED', threadId: 'blog-post-abc' }; // Example: Defining a request payload for creating a new comment const newCommentPayload: CreateCommentRequest = { text: 'A new comment to be posted on the thread.', threadId: 'blog-post-xyz', url: 'https://example.com/blog/post-xyz', // Additional optional fields like parentId, anonymousUser, etc., can be added here }; // Example: Defining widget configuration for embedding FastComments const myWidgetConfig: WidgetConfig = { tenantId: 'your-tenant-id-here', url: 'https://example.com/current-page-url', // Many more configuration options are available theme: 'dark', replyingPlaceholderText: 'Write your reply...', maxCommentLength: 1000, disableVoting: false }; console.log('Defined Comment:', myComment); console.log('Defined New Comment Payload:', newCommentPayload); console.log('Defined Widget Configuration:', myWidgetConfig); // These types provide compile-time safety when interacting with FastComments data and APIs. function handleIncomingComment(commentData: Comment) { console.log(`Received comment from ${commentData.author.displayName}: ${commentData.text.substring(0, 50)}...`); } handleIncomingComment(myComment);
Debug
Known issues
breakingMajor version updates (e.g., v2 to v3) often introduce breaking changes to type definitions, reflecting changes in the FastComments API or underlying data structures. This may require updates to your code to match new property names, types, or required fields.
fix
Review the FastComments changelog and update your code to align with the new type definitions. Re-running `npm install` or `yarn` may be necessary to ensure you have the latest types.
affects: >=3.0.0
gotchaThis package provides only TypeScript type definitions; it contains no runtime JavaScript code or functionality. It is solely used for compile-time type checking and will be entirely removed during compilation to plain JavaScript.
fix
Do not attempt to import or use anything from this package at runtime. Its purpose is purely for development-time type safety. If you need runtime functionality, use the FastComments JavaScript SDK.
affects: >=1.0.0
gotchaEnsure your TypeScript project is configured to correctly resolve modules and type declarations. Incorrect `moduleResolution` settings in `tsconfig.json` can lead to 'Cannot find module' errors even if the package is installed.
fix
Verify `compilerOptions.moduleResolution` is set to 'Node' or 'Bundler' and `compilerOptions.target` is appropriate for your environment in `tsconfig.json`. Ensure `skipLibCheck` is not hiding critical errors.
affects: >=1.0.0
Errors
Common errors & fixes
TS2307: Cannot find module 'fastcomments-typescript' or its corresponding type declarations.
The package is either not installed, not correctly listed in `node_modules`, or TypeScript's `moduleResolution` settings prevent it from being found.
fix
Run `npm install fastcomments-typescript` or `yarn add fastcomments-typescript`. Check your `tsconfig.json` for appropriate `moduleResolution` and `baseUrl` settings.
TS2345: Argument of type '{ /* ... */ }' is not assignable to parameter of type 'Comment'. Property 'id' is missing in type '{ /* ... */ }' but required in type 'Comment'.
An object literal or variable is missing required properties, or has properties with incorrect types, according to the `Comment` (or any other imported) interface/type.
fix
Consult the `fastcomments-typescript` type definitions to ensure all required properties are present and their types match the expected structure. The error message usually points to the specific missing or mismatched property.
Upgrade
Version history
3.0.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
32
OpenAI (training)
1
Resources
fastcomments-typescript — npm install fastcomments-typescript · libregistry