question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when using slugify from TypeScript

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
sylvaindumontcommented, Dec 22, 2017

You have to import it like this

import slugify from 'slugify';

slugify('test test');
4reactions
ndesimonecommented, May 17, 2020

Actually, I found how to make slugify work for me:

import { default as slugify } from 'slugify';

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found