Typescript error: gray-matter.d.ts(43,11): error TS2304: Cannot find name 'Buffer' #68

Open
opened 2018-04-15 22:05:22 +00:00 by michaeljota · 4 comments
michaeljota commented 2018-04-15 22:05:22 +00:00 (Migrated from github.com)

Since Buffer is not available in the browser, when compiling without node types, this error is throw.

Since Buffer is not available in the browser, when compiling without `node` types, this error is throw.
bniedermeyer commented 2018-06-11 01:43:38 +00:00 (Migrated from github.com)

This unfortunately also makes the library almost unusable for Angular based projects since they no longer supply shims for node types that don't exist in the browser in the Angular CLI.

This unfortunately also makes the library almost unusable for Angular based projects since [they no longer supply shims for node types that don't exist in the browser in the Angular CLI. ](https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814)
robertmassaioli commented 2019-01-17 22:49:08 +00:00 (Migrated from github.com)

Since Buffer is not available in the browser, when compiling...

This is an excellent point.

Looking at the typings, it seems that Buffer is used, unnecessarily in one place and for an input type in another. I think we can remove it from the typings and provide and example in the Readme to show how to use buffers instead of strings.

However, to make such a change would be a breaking change, not to the APIs but to the types.

@jonschlinkert my proposal would be:

  1. We fix the typings to remove all references to Buffer. These changes are pushed to a 5.x branch.
  2. We update the README file to explain how to use Buffer with gray-matter.
  3. We release the 5.x branch when ready.

@jonschlinkert What is the process WRT releasing a new major release? When we are ready?

> Since Buffer is not available in the browser, when compiling... This is an excellent point. Looking at the typings, it seems that Buffer is used, unnecessarily in one place and for an input type in another. I think we can remove it from the typings and provide and example in the Readme to show how to use buffers instead of strings. However, to make such a change would be a breaking change, not to the APIs but to the types. @jonschlinkert my proposal would be: 1. We fix the typings to remove all references to Buffer. These changes are pushed to a 5.x branch. 1. We update the README file to explain how to use Buffer with `gray-matter`. 1. We release the 5.x branch when ready. @jonschlinkert What is the process WRT releasing a new major release? When we are ready?
patarapolw commented 2020-01-03 09:43:54 +00:00 (Migrated from github.com)

I can easily install @types/node, but apparently, this is not compatible with @types/webpack-env

I found a solution, if I need to browserify or Webpack,

type Buffer = any
I can easily install `@types/node`, but apparently, this is not compatible with `@types/webpack-env` I found a solution, if I need to browserify or Webpack, ```typescript type Buffer = any ```
cj81499 commented 2020-06-25 00:20:11 +00:00 (Migrated from github.com)

This makes gray-matter difficult to use in Deno. It seems to work (without proper types) from https://jspm.dev, but fails from https://cdn.pika.dev (but types work).

This makes gray-matter difficult to use in Deno. It seems to work (without proper types) from https://jspm.dev, but fails from https://cdn.pika.dev (but types work).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rtlabs-llm-agents/gms-gray-matter#68
No description provided.