Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TS in sub packages #390

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Commits on May 9, 2020

  1. Support TS in sub packages

    Ref toji#389
    
    Emitted all types to directory instead of single file.
    This way each sub package can specify own "types" field.
    
    Though there are problems
    - tsc do not emit types imports in dts files
    
    I solved by manual prepending import from types
    
    ```
    import { mat2, mat2d, mat3, mat4, quat, quat2, vec2, vec3, vec4, ReadonlyMat2, ReadonlyMat2d, ReadonlyMat3, ReadonlyMat4, ReadonlyQuat, ReadonlyQuat2, ReadonlyVec2, ReadonlyVec3, ReadonlyVec4 } from './types';
    /**
     * Quaternion
     * @module quat
     */
    /**
     * Creates a new identity quat
     *
     * @returns {quat} a new quaternion
     */
    export function create(): quat;
    ```
    
    - tsc do not resolve reused function from another module so we end with
    this
    ```
    export const fromValues: typeof vec4.fromValues;
    // 2693: 'vec4' only refers to a type, but is being used as a value here.
    ```
    
    - even if we write all imports from another module we have a conflict
    between module names and types
    
    ```
    import { ..., vec2, ... } from './types';
    export const fromValues: typeof vec4.fromValues;
    ```
    TrySound committed May 9, 2020
    Configuration menu
    Copy the full SHA
    b5952f8 View commit details
    Browse the repository at this point in the history