Error when using slugify from TypeScript
See original GitHub issueI try to use slugify
from TypeScript and get the following error:
Uncaught TypeError: slugify_1.default is not a function
Maybe something is wrong with the type definition?
import {default as slugify} from 'slugify';
slugify('test test');
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
slugify - npm
Start using slugify in your project by running `npm i slugify`. ... slugify. TypeScript icon, indicating that this package has built-in type ...
Read more >TypeScript: Property 'slug' does not exist on type 'Document'
I am using the typescript file. // Core Modules // NPM Modules import mongoose from "mongoose"; import slugify ...
Read more >Routing • Docs • SvelteKit
src/routes/blog/[slug] creates a route with a parameter, slug , that can be used to load data dynamically when a user requests a page...
Read more >Learning TypeScript: Narrowing Types - Aaron Bos
Let's look at how narrowing can fix these issues. ts-error.png. Narrowing With Type Guards. The first option for type narrowing is the use...
Read more >Blog Tutorial (short) - Remix
slug will be defined--maybe you change the name of the file to $postId.ts ! It's good practice to validate that stuff with invariant...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You have to import it like this
Actually, I found how to make slugify work for me:
import { default as slugify } from 'slugify';