# Is it expected for typescript target files generated by compactc to be empty?

**URL:** <https://forum.midnight.network/t/is-it-expected-for-typescript-target-files-generated-by-compactc-to-be-empty/21>\
**Category:** Technical Questions\
**Tags:** previously-asked, compact, learning\
**Created:** [May 12, 2025, 7:12pm UTC](https://forum.midnight.network/t/is-it-expected-for-typescript-target-files-generated-by-compactc-to-be-empty/21 "2025-05-12T19:12:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamanthaHolstine](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.midnight.network/samanthaholstine/32/14_2.png) [@SamanthaHolstine](https://forum.midnight.network/u/SamanthaHolstine)\
**Post date:** [May 12, 2025, 7:12pm UTC](https://forum.midnight.network/t/is-it-expected-for-typescript-target-files-generated-by-compactc-to-be-empty/21/1 "2025-05-12T19:12:12Z")

</div>

I currently have two contracts: a.compact:

```auto
module a {
   export sealed ledger num: Uint<8>;
}

```

b.compact:

```auto
import "a";

constructor() {
  num = 10;
}

```

Is it expected for typescript target files generated by compactc to be empty and look like this:

```auto
import type * as __compactRuntime from '@midnight-ntwrk/compact-runtime';

export type Witnesses<T> = {
}

export type ImpureCircuits<T> = {
}

export type PureCircuits = {
}

export type Circuits<T> = {
}

export type Ledger = {
}

export type ContractReferenceLocations = any;

export declare const contractReferenceLocations : ContractReferenceLocations;

export declare class Contract<T, W extends Witnesses<T> = Witnesses<T>> {
  witnesses: W;
  circuits: Circuits<T>;
  impureCircuits: ImpureCircuits<T>;
  constructor(witnesses: W);
  initialState(context: __compactRuntime.ConstructorContext<T>):__compactRuntime.ConstructorResult<T>;
}

export declare function ledger(state: __compactRuntime.StateValue): Ledger;
export declare const pureCircuits: PureCircuits;

```

---

<div class="post-metadata">

**Author:** ![SamanthaHolstine](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.midnight.network/samanthaholstine/32/14_2.png) [@SamanthaHolstine](https://forum.midnight.network/u/SamanthaHolstine)\
**Post date:** [May 12, 2025, 7:12pm UTC](https://forum.midnight.network/t/is-it-expected-for-typescript-target-files-generated-by-compactc-to-be-empty/21/2 "2025-05-12T19:12:35Z")

</div>

Yes, that’s expected. That contract actually does have a ledger field `num` in its public state, but the field’s not been exported from the contract (`b.compact`) so it’s not visible from the DApp’s JS code. You need:

```auto
export { num };

```

in `b.compact` for that. If contract `b` doesn’t re-export members of module `a` then they’re “private” from the JS code.

It’s moderately confusing that `export` does something (slightly) different in a module definition (makes it available to Compact code that imports the module) and at the top level of a contract (makes it available to the JS code).

The compiler is sometimes aggressive about throwing away unneeded code, but in this case you can see that the constructor is there even when you don’t re-export the module’s field. Search for `10n` in `index.cjs` to see it.
