Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Distribute Typescript type file(s, *.d.ts) to allow type-safe use from Typescript #366

@toasterpic

Description

@toasterpic

TS has support for generating *.d.ts for js by flags(allowJs and declarations) in version 3.7, however it fails when applied to both the distributed firepad 1.5.10 as well as the latest sources.

Version info

Firepad: 1.5.10

Test case

tsc --allowJs --declaration --emitDeclarationOnly ./node_modules/firepad/dist/firepad.js

Expected behavior

valid firepad.d.ts created next to firepad.js

Actual behavior

node_modules/firepad/dist/firepad.js:14:1 - error TS9005: Declaration emit for this file requires using private name 'Entity'. An explicit type annotation may unblock declaration emit.

14 (function (name, definition, context) {
   ~

node_modules/firepad/dist/firepad.js:14:1 - error TS9005: Declaration emit for this file requires using private name 'Firepad'. An explicit type annotation may unblock declaration emit.

14 (function (name, definition, context) {
   ~

node_modules/firepad/dist/firepad.js:14:1 - error TS9005: Declaration emit for this file requires using private name 'Headless'. An explicit type annotation may unblock declaration emit.

14 (function (name, definition, context) {
   ~

node_modules/firepad/dist/firepad.js:14:1 - error TS9005: Declaration emit for this file requires using private name 'MonacoAdapter'. An explicit type annotation may unblock declaration emit.

14 (function (name, definition, context) {
   ~

node_modules/firepad/dist/firepad.js:14:1 - error TS9005: Declaration emit for this file requires using private name 'RichTextCodeMirrorAdapter'. An explicit type annotation may unblock declaration emit.

14 (function (name, definition, context) {
   ~

node_modules/firepad/dist/firepad.js:14:1 - error TS9005: Declaration emit for this file requires using private name 'TextOperation'. An explicit type annotation may unblock declaration emit.

14 (function (name, definition, context) {
   ~


Found 6 errors.

Test case

  1. git clone https://github.com/FirebaseExtended/firepad.git
  2. tsc --init
  3. tsc --allowJs --declaration --emitDeclarationOnly -p .

Actual behavior

examples/firepad-userlist.js:1:1 - error TS9005: Declaration emit for this file requires using private name 'FirepadUserList'. An explicit type annotation may unblock declaration emit.

1 var FirepadUserList = (function() {
  ~~~

lib/monaco-adapter.js:1:1 - error TS9005: Declaration emit for this file requires using private name 'MonacoAdapter'. An explicit type annotation may unblock declaration emit.

1 'use strict';
  ~~~~~~~~~~~~


Found 2 errors.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions